Creates GTFS data feed for Warsaw. Data comes from ZTM Warszawa FTP server and optionally mkuran.pl website.
- Line colors
- Calendar exceptions
- Trip headsigns and On-Request stops
- Added town names to stop_name
- Merging railway stops into one
- Geting railway platforms from external gist
- Geting missing stop positions from external gist
- Inserting metro schedules from mkuran.pl
- Realtime data
- Shapes generator: Buses based on OSM Data, Rail/Tram based on my own graph.
First of all you need Python3 and several modules, included in requirements.txt
, so run pip3 intall -r requirements.txt
.
Then start the script with python3 warsawgtfs.py
Run python3 warsawgts.py -h
to see all possible options with their descriptions.
All of those are optional.
Run python3 warsawgtfs.py
with desired command line options.
After some time (up to 1 min, or 15 mins with the --shapes
option turned on) the gtfs.zip
file should be created.
Produced GTFS feed has additional columns not included in standard GTFS specification:
original_stop_id
instop_times.txt
- WarsawGTFS changes some stop_ids (especially for railway stops and xxxx8x virtual stops), so this column contains original stop_id as referenced in the ZTM file,is_data_source
inattributions.txt
- to indicate that this attribution represents entity that provides data,platform_code
instops.txt
- A platform identifier for (most) railway stops (from Google Transit extensions),stop_IBNR
andstop_PKPPLK
instops.txt
- railway station ids shared by rail operators in Poland.exceptional
intrips.txt
- Value1
indicates an unusual trip which does not follow common line's route (e.g. trips to depot) (from Google Transit extensions).
The warsawgtfs_realtime.py
contains three realtime functions.
All reailtime data is created in gtfs-rt/
directory.
By default only the binary protobuf file is created. Outputing human-readable representation can be done by adding the --readable
flag to the script. An additional JSON file is added when the script sees flag --json
.
-
Alerts (option
-a
/--alerts
):
Arguments:- (optional)
--gtfs-file PATH_OR_URL
- Location of GTFS feed to fetch a list of valid routes. Defaults to https://mkuran.pl/gtfs/warsaw.zip
- (optional)
-
Brigades (option
-b
/--brigades
):
Arguments:--key APIKEY
/-k APIKEY
- The apikey to https://api.um.warszawa.pl,- (optional)
--gtfs-file PATH_OR_URL
- Location of GTFS feed to base brigades on. Defaults to https://mkuran.pl/gtfs/warsaw.zip
Notes:
- Always outputs only a json file,
- Data is valid only on the date of creation - this process has to be run every day.
-
Positions (option
-p
/--position
):
Arguments:--key APIKEY
/-k APIKEY
- The apikey to https://api.um.warszawa.pl,- (optional)
--brigades-file PATH_OR_URL
- Location of the brigades.json file. Defaults to https://mkuran.pl/gtfs/warsaw/brigades.json
Notes:
- This script assumes that all trips are running on time.
- If you wish to update positions in a loop, please
from src import Realtime
and callRealtime.positions()
on your own. It returns matched vehicles, which then can be provided again toRealtime.positions()
for a slightly better accuracy of matching trip_ids (instead of assuming everything runs on time).
Arguments of
Realtime.positions()
:apikey
: Apikey to https://api.um.warszawa.plbrigades
: Path/URL to brigades.jsonprevious
: Dictionary of known vehicles, as returned by this function. If calling for the first time provide an empty dict,{}
.
WarsawGTFS is provided under the MIT license. Please take a look at the license.md
file.