Create GTFS data for Warsaw Public Transport buses, trams, metro and trains.
Written in Python and with the Impuls framework.
Static data comes from a proprietary endpoint shared by ZTM (the Public Transit Authority).
Access to it is restricted; credentials need to be provided through WARSAW_ZTM_USER, WARSAW_ZTM_PASS and WARSAW_ZTM_KEY env variables.
Realtime feeds incorporate data from https://api.um.warszawa.pl.
- Line colors
- Calendar exceptions
- Trip headsigns and requests stops
- Fares
- Unambiguous stop names, prepended by town names when necessary
- Deduplicated stops
- Overrides for faulty stop data (<data_curated/stops.json>)
- Better shapes based on OSM for buses and a custom graph for other modes
- Frequency-based metro schedules (<data_curated/metro>)
- Brigade numbers, planned vehicle types
- Realtime feeds
- Make sure you have a recent Python installation
- Create a new virtual environment for dependency management:
python -m venv --upgrade-deps .venv - Activate the venv:
. .venv/bin/activate - Install dependencies:
pip install -Ur requirements.txt - Provide API keys
- Run the desired script, e.g.
python -m warsaw_gtfs
See python -m warsaw_gtfs -h for all options; most notably --shapes.
Due to the sheer volume of data, the script can take a couple of minutes to run.
Impuls has a smart caching system and won't re-build the GTFS unless necessary.
The part of the project responsible for GTFS-Realtime has been written a long time ago and is ugly and I plan to re-write everything in the future. However, it works for now.
The realtime code is written go and as such require the go command to be available.
You can run the main warsawgtfs_realtime.go script with go run warsawgtfs_realtime.go or by compiling it first with go build warsawgtfs_realtime.go.
There are several dependencies required by this project, all listed in the go.mod file.
AFAIK they should be downloaded automatically when running/compiling the project.
If they are not, go mod download explicitly downloads the dependencies.
Position data are mostly based on data from https://api.um.warszawa.pl, while alerts are downloaded from https://www.wtp.waw.pl/utrudnienia/ and https://www.wtp.waw.pl/zmiany/
Creates the GTFS-Realtime feed with a list of all known alerts.
This mode is enabled by the -a command line flag. Here are all available options:
-json: Apart from the GTFS-RT file, write the parsed alerts into a custom JSON format-readable: Use a human-readable GTFS-RT format instead of the binary one-strict: Failing to get more data about an alert from the wtp.waw.pl causes an error, instead of being ignored-gtfs-file SOME_FILE_OR_URL: from which file should available routes be loaded? defaults to https://mkuran.pl/gtfs/warsaw.zip-target SOME_FOLDER: where to put the created files? defaults todata_rt-loop DURATION: if positive (e.g.1m30s), updates the files every DURATION. defaults to0s, loop mode disabled.-checkdata DURATION: when in loop-mode, decides how often should the-gtfs-filebe checked for changes. defaults to30m.
Creates the GTFS-Realtime feed with a vehicle positions and their active trips.
This mode is enabled by the -p command line flag. Here are all available options:
-k(required): apikey to api.um.warszawa.pl-json: Apart from the GTFS-RT file, write the parsed positions into a custom JSON format-readable: Use a human-readable GTFS-RT format instead of the binary one-gtfs-file SOME_FILE_OR_URL: from which GTFS file should trips&brigades be loaded? defaults to https://mkuran.pl/gtfs/warsaw.zip-target SOME_FOLDER: where to put the created files? defaults todata_rt-loop DURATION: if positive (e.g.30s), updates the files every DURATION. defaults to0s, loop mode disabled.-checkdata DURATION: when in loop-mode, decides how often should the-gtfs-filebe checked for changes. defaults to30m.
WarsawGTFS is provided under the MIT license. Please take a look at the license.md file.