Ero sivun ”GTFS-RT” versioiden välillä
Rivi 41: | Rivi 41: | ||
} | } | ||
</pre> | </pre> | ||
The feed provides a JSON "entity" list, where each entity represents a monitored vehicle (bus). For each vehicle, following information is provided: | |||
* trip information: trip's start date, start time and the route id (which in Tampere data corresponds to the line name displayed in the bus head sign) | |||
* position information: the vehicle's latitude and longitude as well as the bearing (in degrees, rotated clockwise, 0 equals north) | |||
* vehicle id, which identifies the actual vehicle (bus) in question | |||
The timestamp field in the header section identifies the time when the response was generated on the server. |
Versio 6. tammikuuta 2016 kello 22.15
Concept
GTFS-RT is a lightweight API which allows developers to access public transport data via Google Protobuf protocol (over HTTP). Also JSON over HTTP interface is provided. Following GTFS-RT related feeds are implemented:
- Vechile Positions
- Service Alerts
please see https://developers.google.com/transit/gtfs-realtime/ for more information on GTFS-RT.
Vechile Positions
- Vehicle positions feed (JSON) is accessible at http://data.itsfactory.fi/journeys/api/1/gtfs-rt/vehicle-positions/json
- Vehicle positions feed (Protobuf) is accessible at http://data.itsfactory.fi/journeys/api/1/gtfs-rt/vehicle-positions
Please note that Protobuf is binary protocol, so your browser probably will trigger download dialog if you use the protobuf URL. Below is a sample of vehicle positions (JSON) feed:
{ "header": { "gtfs_realtime_version": "1.0", "incrementality": "FULL_DATASET", "timestamp": 1452109419 }, "entity": [ { "id": "0", "vehicle": { "trip": { "start_time": "21:58:00", "start_date": "20160106", "route_id": "3" }, "position": { "latitude": 61.527477, "longitude": 23.706625, "bearing": 237 }, "vehicle": { "id": "TKL_41" } } } ... ] }
The feed provides a JSON "entity" list, where each entity represents a monitored vehicle (bus). For each vehicle, following information is provided:
- trip information: trip's start date, start time and the route id (which in Tampere data corresponds to the line name displayed in the bus head sign)
- position information: the vehicle's latitude and longitude as well as the bearing (in degrees, rotated clockwise, 0 equals north)
- vehicle id, which identifies the actual vehicle (bus) in question
The timestamp field in the header section identifies the time when the response was generated on the server.