Skip to content

VerkehrsbetriebeZuerich/tram-locator

Repository files navigation

Tram Locator

About

Script to locate all running trams within the VBZ network. The trams locations is based on static timetable and dynamic timetable updates (live delays) accessed via opentransportdata.swiss API. A CSV file with all currently running trams and their corresponding location, destination and delay information is written as an output file.

Installation

Use the package manager pip to install all required packets.

pip install -r requirements.txt

Register as a user on open data platform on mobility in Switzerland and request for a API token on the "GTFS-RT Beta" API. Place your Token at the start of the "dataAnalyser.py". Here you can also define your update interval. An interval faster then every 60s is not useful, since the resolution of the timetable is one minute and you will run into API request limitations.

APIKEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
INTERVAL_S = 60.0

Usage

Run once (or every week when new dataset is available) to get the static timetable from open data platform on mobility in Switzerland.

python prepare_weekly_run.py

Run continuously to load and apply dynamic timetable changes to static data and export tram location file.

python dataAnalyser.py

Additional information

  • An live visualisation of this data can be viewed at tramtracker.ch.
  • current_status.csv lists all trams and they corresponding position. The trip destination, tram number and delay (minutes) is also included.
  • The file stop_locations.csv contains the coordinates of all 204 VBZ tram stops.
  • All date will be save on relative paths from the current working directory.

Author

Ueli Schön

License

MIT

About

Script to locate all running trams within the VBZ network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages