ArticleslgStudy

computer science

GTFS Realtime

GTFS Realtime is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GTFS Realtime rather than just read about it. In short: 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. Realtime location data is created continuously by an agency from automatic vehicle location (AVL) systems.

GTFS Realtime — main illustration
GTFS Realtime — illustration

Key takeaways

  • GTFS Realtime belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GTFS Realtime to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GTFS Realtime from memory before moving on to harder problems.

Reference excerpt

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. 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. 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 (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. 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 (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. 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

Alerts can be shown to mapping application users to alert them of detours, cancellations, or other service changes. 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.

See Also NeTEx SIRI

References

Illustrations

GTFS Realtime illustration
GTFS Realtime: MTA Subway GTFS-RT Alerts
MTA Subway GTFS-RT Alerts

Worked examples

Example 1 — a first encounter with GTFS Realtime

Start with the simplest possible case. Write down what GTFS Realtime claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GTFS Realtime before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GTFS Realtime ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GTFS Realtime

In research
GTFS Realtime appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GTFS Realtime in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GTFS Realtime is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer file formats, Public transport information systems, Real-time computing, so understanding it makes those chapters shorter.
In everyday life
Look for GTFS Realtime outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study GTFS Realtime in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GTFS Realtime means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GTFS Realtime out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GTFS Realtime in simple terms?

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. Realtime location data is created continuously by an agency fr…

Why does GTFS Realtime matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GTFS Realtime?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GTFS Realtime.

Tags

  • Computer file formats
  • Public transport information systems
  • Real-time computing
  • Scheduling (transportation)
  • Web syndication formats

Keep exploring