====== GTFS ======
A GTFS feed is composed of a series of text files collected in a ZIP file. Each file models a particular aspect of transit information: stops, routes, trips, and other schedule data. The details of each file are defined in the GTFS reference.
GTFS Spezification: https://developers.google.com/transit/gtfs/reference/
Check out https://github.com/CUTR-at-USF/awesome-transit for an up to date list of GTFS sources, tools and more.
* Routes are equivalent to "Lines" in public transportation systems. Routes are defined in the file routes.txt, and are made up of one or more Trips.
* A Trip represents a journey taken by a vehicle through Stops. Trips are time-specific — they are defined as a sequence of StopTimes, so a single Trip represents one journey along a transit line or route.
* A StopTime defines when a vehicle arrives at a location, how long it stays there, and when it departs.
===== Data =====
Worldwide:
https://transitfeeds.com/feeds
https://transit.land/feed-registry/
Switzerland: https://opendata.swiss/de/dataset/timetable-2019-gtfs
Vienna: https://www.data.gv.at/katalog/dataset/ab4a73b6-1c2d-42e1-b4d9-049e04889cf0
===== Tools =====
==== GTFS.html ====
quickly browse/validate a GTFS file. It even includes a map view.
Visit https://gtfs.pleasantprogrammer.com and upload your GTFS (it's a local web app)
==== static-GTFS-manager ====
GTFS editor, not as powerful as IBI transit (e.g. does not even have a map view for routes), but easy to install (simply download and run the executable)
https://github.com/WRI-Cities/static-GTFS-manager
==== IBI transit ====
Suite for importing / creating / editing and publishing GTFS feeds.
Quite complex to set up, but very powerful: https://data-tools-docs.ibi-transit.com/en/latest/dev/deployment/
==== OneBusAway (Java/CLI) ====
Nice command line tool to extract / merge / edit GTFS.
[[https://github.com/OneBusAway/onebusaway/wiki|OneBusAway]] is a library for transforming and merging GTFS data sets. Amongst others it features two handy CLIs:
[[http://developer.onebusaway.org/modules/onebusaway-gtfs-modules/current/onebusaway-gtfs-transformer-cli.html|http://developer.onebusaway.org/modules/onebusaway-gtfs-modules/current/onebusaway-gtfs-transformer-cli.html]]\\
[[http://developer.onebusaway.org/modules/onebusaway-gtfs-modules/current/onebusaway-gtfs-merge-cli.html|http://developer.onebusaway.org/modules/onebusaway-gtfs-modules/current/onebusaway-gtfs-merge-cli.html]]
As of 2021 current builds are no longer provided (not in maven central, and not on the onebusaway nexus) - so probably you have to build it from source.
Nexus:\\
[[http://nexus.onebusaway.org/nexus/content/groups/public/org/onebusaway/onebusaway-gtfs-transformer-cli|http://nexus.onebusaway.org/nexus/content/groups/public/org/onebusaway/onebusaway-gtfs-transformer-cli]]\\
[[http://nexus.onebusaway.org/nexus/content/groups/public/org/onebusaway/onebusaway-gtfs-merge-cli|http://nexus.onebusaway.org/nexus/content/groups/public/org/onebusaway/onebusaway-gtfs-merge-cli]]
=== Example: remove AST ===
no_ast.txt:
{"op":"remove","match":{"file":"routes.txt","route_short_name":"AST AST"}}
{"op":"remove","match":{"file":"routes.txt","route_short_name":"AST AST Maxi"}}
java -jar onebusaway-gtfs-transformer-cli-1.3.X.jar --transform=remove_ast.txt gtfs.zip gtfs_without_ast.zip
=== Example: only keep two lines from a whole dataset ===
java -jar onebusaway-gtfs-transformer-cli-1.3.34.jar --transform='{"op":"retain", "match":{"file":"routes.txt", "route_short_name":"31"}}' --transform='{"op":"retain", "match":{"file":"routes.txt", "route_short_name":"33A"}}' gtfs_vienna.zip gtfs_vienna_only31+33A.zip
==== transitfeed (Python - outdated!) ====
by Google https://github.com/google/transitfeed/wiki
sudo pip install transitfeed
Or get the trunk from
svn co https://github.com/google/transitfeed.git/trunk
Comes with some command line tools
* feedvalidator
* kmlwriter
==== Python ====
* [[https://github.com/kotrc/GTFS-route-shapes|python script to convert GTFS to geojson]]
* [[https://pygtfs.readthedocs.io/en/latest/index.html|pygtfs (seems outdated)]]
==== Others ====
* JavaScript based GUI (runs in browser) https://github.com/WRI-Cities/static-GTFS-manager
* R package by ROpenSciLabs https://github.com/ropenscilabs/gtfsr
* Javascript by Conveyal https://github.com/conveyal/gtfs-data-manager
* FME https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/gtfs/gtfs.htm
====== Working with GTFS ======
===== On receiving a GTFS archive =====
Use transitfeeds feedvalidator.py on a zip file to obtain a detailed report on the data quality.