Skip to content

GTFS Realtime Tutorial #2: How to produce GTFS realtime trip update and vehicle position feed

Kelly Dunn edited this page Feb 21, 2021 · 3 revisions

The following tutorial was created by Brian Ferris:

In my second tutorial about working with GTFS-realtime data, I'm going to be talking about trip updates:

https://developers.google.com/transit/gtfs-realtime/guides/trip-updates

Trip updates attempt to answer one question on every rider's mind: when is my bus going to be here? How late is my train?

Trip updates capture information about trips currently being run by transit vehicles, including information about estimated arrival times and delays at stops along that trip. Here, we are using trip in the GTFS sense of the word. There isn't necessarily a one-to-one mapping between vehicles active in the field and trip updates, as updates might be provided both for the trip a vehicle is currently on and for the trip it's about to start in a few minutes.

How can a transit agency produce a GTFS-realtime trip updates feed? I've put together a demo project that takes vehicle in a custom format from an agency (specifically, SEPTA's train tracker feed) and walk you through how to create a GTFS-realtime trip updates feed from the data. This project page includes instructions on downloading the source-code and running the project, as well as a detailed walk-through of the code where GTFS-realtime trip updates are constructed. As a bonus, I also show an example of a GTFS-realtime vehicle position feed as well. Hopefully, the project can serve as a starting point for any agency wanting to publish their real-time trip data.

I hope you find this useful! Stay tuned for more tutorials about working with GTFS-realtime data.