Skip to content

MKuranowski/TristarGTFS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TristarGTFS

Description

Creates GTFS/GTFS-Realtime data feed for Gdańsk and Gdynia.
Data comes from Open Gdańsk project and Gdynia open data project.
The script can also generate shapes.txt for Gdynia shcedules, which whill in turn use data from © OpenStreetMap contributors.

Some precautions

  • Produced feed will use extended type 800 for trolleybuses.
  • Data is created up to last day, when schedules are avialable for all agencies.
  • Both ZTM Gdańsk and ZKM Gdynia data sources share their data under CC BY license, so you have to credit them.
    This can be done by exposing the data from feed_info.txt file, columns feed_provider_name, feed_publisher_url and feed_version.

Ids

Because route_ids, trip_ids and service_ids could collide between ZTM Gdańsk and ZKM Gdynia data sources, each route_id, trip_id and service_id is prefixed with 1: for ZTM Gdańsk data and 2: for ZKM Gdynia data.

As of the time writing the stop merge table references unexisting stops — it is not used. All ZTM Gdańsk stop_ids are asserted to be < 30000 and all ZKM Gdynia stop_ids are asserted to be >= 30000.

Running

First Launch

Of course you will need Python3 (version 3.6 or later), with these modules:

Before launching install required modules with pip3 install -r requirements.txt
Each script can launch without any command line options, but you may want to take a look at them.

Static GTFS - tristargtfs.py

python3 tristargtfs.py - Creates GTFS file in gtfs.zip without shapes.

Options:

  • -o / --output-file TARGET-PATH-OF-GTFS.zip: Destination path of the gtfs archive,
  • -s / --shapes: Use OSM to gerenate shapes for ZKM Gdynia + copy ZTM Gdańsk shapes.

Realtime GTFS - tristargtfs_realtime.py

python3 tristargtfs_realtime.py - Creates binary GTFS-RT file in gtfs-rt.pb for mkuran.pl Tristar GTFS

Options:

  • -o / --output-file TARGET-PATH-OF-GTFS-RT.pb: Destination of gtfs-realtime file,
  • --gtfs PATH-OR-URL-TO-GTFS: Path/URL to the Tristar GTFS file to use as a base for RT data,
  • --readable: Output data to a human-readable protobuff instead of binary one,
  • --debug: Do some more printing when there are issues with encountered data,
  • -l / --loop: Run the script in a loop - autmoatically update the taget-file,
  • -p / --peroid SECONDS: How often should the target-file should be updated (for --loop, default 30s),
  • --gtfs-check-peroid SECONDS: How often should the script check if gtfs file has changed (for -loop, default 1800s/30min).

License

TristarGTFS is provided under the MIT license, included in the license.md file.

About

Creates GTFS feed for ZTM Gdańsk and ZKM Gdynia from Gdańsk's open data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages