Skip to content
Standalone utility to convert gtfs-realtime feeds into simple JSON.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
proto
samples
.gitignore
LICENSE
README.md
gtfs_realtime_json.py
gtfs_realtime_pb2.py
json_gtfs_realtime.py
nyct_subway_pb2.py
protobuf_json.py
pyinstaller.sh
requirements.txt initial release Feb 25, 2015

README.md

gtfs_realtime_json

Standalone utility to convert gtfs-realtime feeds into simple JSON (and backward).

Download

Usage

$ gtfs_realtime_json <feed_url>

Examples:

$ gtfs_realtime_json "http://api.bart.gov/gtfsrt/tripupdate.aspx"
{"header":{"gtfs_realtime_version":"1.0","timestamp":1424843250, ... }

$ gtfs_realtime_json "http://api.bart.gov/gtfsrt/tripupdate.aspx" > output.json
// save JSON to output.json file

Sample JSON Outputs:

  • MTA Trip Update json
  • BART Trip Update json

Converting a JSON to a protobuf file

First create a virtualenv:

$ mkvirtualenv gtfs_realtime_json
$ pip install -r requirements.txt

Then each time simply:

$ workon gtfs_realtime_json
$ ./json_gtfs_realtime.py file:gtfsrt.json gtfsrt.pb

GTFS-realtime Feed Sources

If you have any updates to this list, please message me or submit a PR!

Last Updated: 02-25-2015

Working Feeds:

  • MTA (link)

    • Trip Updates (1, 2, 3, 4, 5, 6, S lines):
      http://datamine.mta.info/mta_esi.php?key=<key>&feed_id=1
    • Trip Updates (L line):
      http://datamine.mta.info/mta_esi.php?key=<key>&feed_id=2
    • Trip Updates (Staten Island Railway):
      http://datamine.mta.info/mta_esi.php?key=<key>&feed_id=11
    • Note: NYCT's custom gtfs-realtime extensions have been included.
    • Note: An API key is required for these feeds.
  • ART (link)

    • Trip Updates:
      http://realtime.commuterpage.com/rtt/public/utility/gtfsrealtime.aspx/tripupdate
  • MBTA (link)

    • Service Alerts:
      http://developer.mbta.com/lib/GTRTFS/Alerts/Alerts.pb
    • Trip Updates:
      http://developer.mbta.com/lib/GTRTFS/Alerts/TripUpdates.pb
    • Vehicle Positions:
      http://developer.mbta.com/lib/GTRTFS/Alerts/VehiclePositions.pb
  • BART (link)

    • Service Alerts:
      http://api.bart.gov/gtfsrt/alerts.aspx
    • Trip Updates:
      http://api.bart.gov/gtfsrt/tripupdate.aspx
  • YRT/Viva (link)

    • Service Alerts:
      http://rtu.york.ca/gtfsrealtime/ServiceAlerts
    • Trip Updates:
      http://rtu.york.ca/gtfsrealtime/TripUpdates
    • Vehicle Positions:
      http://rtu.york.ca/gtfsrealtime/VehiclePositions

Feeds Not Yet Confirmed:

Feeds Not Working:

Compiling

$ virtualenv .venv (optional)
$ pip install -r requirements.txt
$ ./pyinstaller.sh (See dist/gtfs_realtime_json)

You can’t perform that action at this time.