This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gtfs [2018/12/13 13:54] mantis [Others] |
gtfs [2021/09/09 10:53] mstraub |
||
---|---|---|---|
Line 6: | Line 6: | ||
GTFS Spezification: https://developers.google.com/transit/gtfs/reference/ | GTFS Spezification: https://developers.google.com/transit/gtfs/reference/ | ||
- | 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. | + | Check out https://github.com/CUTR-at-USF/awesome-transit for an up to date list of GTFS sources, tools and more. |
- | 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. | + | * 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 ===== | ===== Data ===== | ||
- | Worldwide: https://transitfeeds.com/feeds | + | 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 ===== | ===== Tools ===== | ||
+ | ==== GTFS.html ==== | ||
- | ==== transitfeed (Python) ==== | + | 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: | ||
+ | |||
+ | <file> | ||
+ | {"op":"remove","match":{"file":"routes.txt","route_short_name":"AST AST"}} | ||
+ | {"op":"remove","match":{"file":"routes.txt","route_short_name":"AST AST Maxi"}} | ||
+ | </file> | ||
+ | |||
+ | <code> | ||
+ | java -jar onebusaway-gtfs-transformer-cli-1.3.X.jar --transform=remove_ast.txt gtfs.zip gtfs_without_ast.zip | ||
+ | </code> | ||
+ | |||
+ | === Example: only keep two lines from a whole dataset === | ||
+ | |||
+ | <code> | ||
+ | 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 | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ==== transitfeed (Python - outdated!) ==== | ||
Line 36: | Line 96: | ||
Comes with some command line tools | Comes with some command line tools | ||
- | * feedvalidator | + | * feedvalidator |
- | * kmlwriter | + | * kmlwriter |
- | ==== Others ==== | ||
+ | ==== Python ==== | ||
- | R package by ROpenSciLabs https://github.com/ropenscilabs/gtfsr | + | * [[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)]] | ||
- | Javascript by Conveyal https://github.com/conveyal/gtfs-data-manager | + | ==== Others ==== |
- | FME https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/gtfs/gtfs.htm | + | * 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 ====== | ====== Working with GTFS ====== | ||
Line 52: | Line 116: | ||
- | On receiving a GTFS archive | + | ===== On receiving a GTFS archive ===== |
Use transitfeeds feedvalidator.py on a zip file to obtain a detailed report on the data quality. | Use transitfeeds feedvalidator.py on a zip file to obtain a detailed report on the data quality. | ||
- | Loading in Java | + | |