GTFS Realtime

From HandWiki
Short description: Standard for real-time public transport data
GTFS Realtime
GTFS Realtime Visualisation.png
Example of GTFS Realtime Visualisation of LA Metro
Filename extension.pb
Initial release27 September 2011; 12 years ago (2011-09-27)
Latest release
2.0
(22 February 2023; 11 months ago (2023-02-22))
Type of formatTransit realtime data format
Extended fromProtocol Buffers
StandardDe facto standard
Websitegtfs.org/realtime/

GTFS Realtime (also known as GTFS-rt) 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.[1]

Realtime location data is created continuously by an agency from Automatic vehicle location (AVL) systems. Trip arrival times are computed using machine learning models that analyse historical positional data and timetables.[2]

History

On 22 August 2011, a first version of GTFS-rt was released.[3]

In July 2012, Google Maps began showing alerts from GTFS-rt.[4]

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.[5]While the majority of agencies separate feed entity types (Vehicle Positions, Trips, and Alerts), 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 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 proposed change has been released to users in the Transit app across several agencies, but is yet to be adopted into the official standard.[6]

Standard

The GTFS Realtime specification is defined by a .proto file hosted by Google.[7] 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 is the fourth feed type and is 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 Static, 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.

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.[8]

This feed contains an array of Trip Updates. Each trip update enumerates a description of a trip (trip id, route id, start and stop time, direction), 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 static feed the agency provides.

Vehicle positions

Vehicle Positions are sometimes shown on mapping applications to aid users in tracking the location of buses.[9] This feed contains an array of VehiclePositions. Like Trip Updates, each VehiclePosition can also contain a basic description of the trip, such as its trip id, start and stop times, route number, and relationship to the schedule. The VehiclePosition also contains the current latitude and longitude of the vehicle, and can also include bearing, odometer, and speed. Finally, it can also contain information on how crowded the bus is, known as occupancy status, and status of road congestion experienced by the vehicle.

Alerts

MTA Subway GTFS-rt Alerts being posted on Transit App

Alerts can be shown to mapping application users to alert them of detours, cancellations, or other service changes.[10] This feed contains an array of Alerts. Alerts typically don't update as often as Vehicle Positions or Trip Updates. Each Alert stores the cause (such as labour strike or a mechanical fault) of an incident, along with its effect (reduced service, detour, stop cancellation, etc.). Alerts also contain detailed headers, descriptions, urls, images, and a list of routes or stops affected (known as the Informed Entity). Alerts also contain beginning and expiration times, known as Active Periods.

References