fabmazz / gtfs_realtime_json

Standalone utility to convert gtfs-realtime feeds into simple JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

About

Standalone utility to convert gtfs-realtime feeds into simple JSON.

License:MIT License


Languages

Language:Python 98.4%Language:Shell 1.6%