GTFS Realtime

{{Short description|Standard for real-time public transport data}}

{{Multiple issues|

{{Primary sources|date=February 2024}}

{{Sources exist|date=February 2024}}

}}

{{Infobox file format

| name = GTFS Realtime

| icon =

| icon_size =

| iconcaption =

| screenshot = GTFS Realtime Visualisation.png

| caption = Example of GTFS Realtime Visualisation of Los Angeles Metro

| screenshot_size =

| extension = .pb

| _noextcode =

| mime =

| _nomimecode =

| type code =

| uniform_type =

| conforms_to =

| magic =

| developer =

| released = {{start date and age|2011|09|27|df=yes}}

| latest_release_version = 2.0

| latest_release_date = {{start date and age|2024|03|11|df=yes}}

| container_for =

| contained_by =

| extended_from = Protocol Buffers

| extended_to =

| standard = De facto standard

| open = Yes, CC BY 3.0

| url = {{URL|https://gtfs.org/realtime/}}

| genre = Transit realtime data format

}}

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.{{Cite web |title=Reference - General Transit Feed Specification |url=https://gtfs.org/realtime/reference/ |access-date=2023-07-31 |website=gtfs.org}}

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.{{Cite web |last=Parkford |first=Stan |date=30 August 2021 |title=How do predictions work? |url=https://swiftly.zendesk.com/hc/en-us/articles/360019102211-How-do-predictions-work- |website=Swiftly Help Center}}

The standard is used by public transport agencies globally, including the United States, Canada, most countries in the European Union, United Kingdom, Australia, New Zealand, and in Yokohama, Japan.

History

On 22 August 2011, a first version of GTFS-rt was released by Google.{{Cite web |title=Revision history {{!}} Realtime Transit |url=https://developers.google.com/transit/gtfs-realtime/guides/revision-history |access-date=2023-07-31 |website=Google for Developers |language=en}} This data was shown to Google Maps users.{{Cite web |title=Know when your bus is late with live transit updates in Google Maps |url=https://googleblog.blogspot.com/2011/06/know-when-your-bus-is-late-with-live.html |access-date=2024-02-02 |website=Official Google Blog |language=en}}

In July 2012, Google Maps began showing alerts from GTFS-rt.{{Cite web |last=Del Signore |first=John |date=2012-07-31 |title=Google Maps Now Features Alerts On Subway Service Changes |url=https://gothamist.com/news/google-maps-now-features-alerts-on-subway-service-changes |access-date=2023-08-07 |website=Gothamist |language=en}}

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.{{Cite web |title=Allow multiple feed entity types in a single feed by egorich239 · Pull Request #7 · google/transit |url=https://github.com/google/transit/pull/7 |access-date=2023-12-07 |website=GitHub |language=en}} 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 2022, CalTrans' Integrated Travel Project began validating GTFS Schedule and Realtime feeds published by municipality and county public transport agencies within California.{{Cite web |date=2022-06-07 |title=Cal-ITP unveils new open data standard to improve transit agency operations |url=https://www.masstransitmag.com/technology/miscellaneous/press-release/21270208/caltrans-california-department-of-transportation-calitp-unveils-new-open-data-standard-to-improve-transit-agency-operations |access-date=2024-02-02 |website=Mass Transit}} 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.{{Cite web |title=GTFS Trip-Modifications by gcamp · Pull Request #403 · google/transit |url=https://github.com/google/transit/pull/403 |access-date=2023-12-07 |website=GitHub |language=en}}

Standard

The GTFS Realtime specification is defined by a .proto file hosted by Google.{{Cite web|url=https://github.com/google/transit/blob/master/gtfs-realtime/proto/gtfs-realtime.proto|title=transit/gtfs-realtime/proto/gtfs-realtime.proto at master · google/transit|website=GitHub}} 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.{{Cite web |title=Provide realtime trip information with TripUpdates - Transit Partners Help |url=https://support.google.com/transitpartners/answer/10105040?hl=en |access-date=2023-08-07 |website=support.google.com}}

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

= Vehicle positions =

Vehicle Positions are sometimes shown on mapping applications to aid users in tracking the location of buses.{{Cite web |title=Vehicle Positions {{!}} Realtime Transit |url=https://developers.google.com/transit/gtfs-realtime/guides/vehicle-positions |access-date=2023-08-07 |website=Google for Developers |language=en}} 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 in m/s. 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 =

File:Alerts_Transit_App_New_York_City.jpg

Alerts can be shown to mapping application users to alert them of detours, cancellations, or other service changes.{{Cite web |title=Service Alerts {{!}} Realtime Transit |url=https://developers.google.com/transit/gtfs-realtime/guides/service-alerts |access-date=2023-08-07 |website=Google for Developers |language=en}} 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 specify their beginning and expiration times using "active periods". Alerts can be localised into several languages.

References