CodeforSouth / LeafletTransit

:zap: :sleeping: LeafletJS app showing ALL methods of Miami transit services.
http://codeforsouth.github.io/LeafletTransit
14 stars 3 forks source link

GTFS Realtime #49

Open dannav opened 8 years ago

qtrandev commented 8 years ago

Create a GTFS-realtime feed for City of Miami trolley system which already has realtime data.

I have a basic outline of the GTFS zip schedule data here: https://github.com/qtrandev/OneBusAway/tree/master/GTFS

Realtime data is here: http://miami.etaspot.net/ You'll need to format that to the GTFS-realtime format which might be hard (https://developers.google.com/transit/gtfs-realtime/?hl=en) Create this server in your favorite language like Go. The miami-transit-api project already has this server in Ruby (with 1 pull request from Bryce).

Here's a sample of what the feed looks like: https://github.com/qtrandev/OneBusAway/wiki#6-setting-up-a-gtfs-realtime-gtfs-rt-feed (JSON instead of protocol buffers here)

qtrandev commented 8 years ago

Here is a sample of how San Francisco's Bay Area Rapid Transit (BART) shows their realtime feeds: http://www.bart.gov/schedules/developers/gtfs-realtime This is a Trip Updates feed:

header {
  gtfs_realtime_version: "1.0"
  incrementality: FULL_DATASET
  timestamp: 1449934745
}
entity {
  id: "06R11SAT"
  trip_update {
    trip {
      trip_id: "06R11SAT"
    }
    stop_time_update {
      stop_sequence: 7
      departure {
        delay: 0
        uncertainty: 30
      }
      stop_id: "COLS"
    }
  }
}
entity {
  id: "07R11SAT"
  trip_update {
    trip {
      trip_id: "07R11SAT"
    }
    stop_time_update {
      stop_sequence: 2
      departure {
        delay: 0
        uncertainty: 30
      }
      stop_id: "UCTY"
    }
  }
}

An easier feed to do is just the Vehicle Positions feed. This feed only shows the GPS locations, not any delay information. To convert the data from Protocol Buffer to text, use this program on Windows or look for a similar alternative: ProtoBuf Parser to convert gtfsrt files to text - http://realtime.mbta.com/Portal/Content/Download/GTFS-realtime_Parser.zip

Read through this entire wiki page for more information and resources: https://github.com/qtrandev/OneBusAway/wiki

There is a Ruby On Rails server already set up show a Trip Updates feed for Miami-Dade Transit buses, but I don't know how useful this is for other languages (browse the rest of the code for some City of Miami data processing for GTFS zip creation): https://github.com/qtrandev/miami-transit-api-nitrous/blob/master/app/models/miami_dade_bus_translator.rb

qtrandev commented 8 years ago

Direct link to get City of Miami live trolleys: http://miami.etaspot.net/service.php?service=get_vehicles&includeETAData=1&orderedETAArray=1&token=TESTING

Some very old code (no longer in use) used to process this data: https://github.com/Code-for-Miami/LeafletTransit/blob/da98d0033a321f6008b707f503255e52906c971a/index.js#L749