GTFS Realtime
GTFS Realtime is an extension to GTFS, in which public transport agencies share real-time vehicle locations, arrival time predictions, and alerts such as detours and cancellations via Protocol Buffers web server.
Realtime location data is created continuously by an agency from automatic vehicle location systems. Trip arrival times are computed using machine learning models that analyse historical positional data and timetables. Data is transferred to user facing apps such as Apple Maps or Google Maps. It can also be collected for research purposes.
The standard is used by public transport agencies around the world, including the United States, Canada, most countries in the European Union & Schengen Area, United Kingdom, Australia, New Zealand, and in Japan.
History
On 22 August 2011, a first version of GTFS-rt was released by Google. This data was shown to Google Maps users.In July 2012, Google Maps began showing alerts from GTFS-rt.
A proposal that was created on July 28, 2015, and merged on Aug 15, 2015 allowed the combination of several feed entity types into a single feed. While the majority of agencies separate feed entity types, some feeds are still joined.
On August 30, 2021, an experimental feed entity types, Shapes, was released. Shapes has the ability to update route shapes in real time to reflect detour, as route updates are either reflected by referencing an existing
shape_id or by defining in real time a new shape as an encoded polyline.In 2022, CalTrans' Integrated Travel Project began validating GTFS Schedule and Realtime feeds published by municipality and county public transport agencies within California. Monthly reports are published on the errors in agency data, along with analysis of typical street speeds and traffic.
In September 2023, Swiftly and the app Transit proposed 2 additional feed entity types: Stop and Trip Modifications. These allow agencies to broadcast new detour paths of routes and new temporary stops. The change has been released to users in the Transit app across several agencies. On March 11, 2024, the proposal was merged and released by GTFS maintainers.
Standard
The GTFS Realtime specification is defined by a.proto file hosted by Google. Data is serialized into raw bytes by the server and then deserialized by a client. Officially supported GTFS-rt binding libraries have been built in.NET, Java, JavaScript, Python, and Go. Unofficial libraries have been written in other languages, such as Rust.There are currently three official feed types defined in the standard, TripUpdates, VehiclePositions, and Alerts. Shapes, Trip Modifications, and Stops are currently experimental.
Agencies supporting GTFS-Realtime typically provide separate urls for the three separate feed types, and may choose to only provide some of the feeds. Unlike GTFS Schedule zip files, many agencies may require developers to request an API key via email or a web form.
Developers then write programs to periodically fetch an agency's web API over HTTP, typically every few seconds to minutes. Agencies typically refresh data in frequencies ranging between 1 second to 1 minute. There is no standard for streaming GTFS Realtime data, also support is built in to allow for deletion of items from previous iterations.
Trip updates
In the GTFS Specification, a trip refers to an operator driving a fixed-route vehicle from the start of the route to the end. A new trip is started for when the vehicle turns around at the end of its route.The Trip Update feed allows maps to show the departure or arrival times of vehicles, and allows routing algorithms to update their directions.
This feed contains an array of Trip Updates. Each trip update enumerates a description of a trip, last updated time, may include an associated vehicle number and route number, and contains an array of StopTimeUpdate. The StopTimeUpdate can define past, current, and future stop times, delays, and cancellations. The stop id references the GTFS Schedule feed the agency provides.