-
Notifications
You must be signed in to change notification settings - Fork 73
GTFS Realtime Tutorial #4: GTFS in the API ecosystem
The following tutorial was created by Brian Ferris:
In my fourth tutorial about working with GTFS-realtime data, I want to talk about low-level vs high-level APIs, where GTFS-realtime falls on the spectrum, and how existing tools can complement GTFS-realtime.
When you think about specifications for exchanging transit data, they generally tend to fall into one of two camps:
- High-level application-oriented APIs designed to make building applications that answer specific questions very easy.
- Low-level data APIs designed to make building applications that answer many different questions possible, though not always very easy.
Consider a simple web-based api that supports a method for telling you the next three buses departing from a stop. This is a high-level API that makes it easy to write a simple "when is my bus coming?" app.
Now consider a GTFS feed for this same system. With some work you can construct a query for telling you the next three buses departing from a stop, but you can also tweak that query to tell you the next four buses, or the next three buses headed in a particular direction, or the the next three buses an hour from now. Here, GTFS is a low-level data API.
GTFS-realtime is definitely a low-level API as well. GTFS-realtime is not optimized for writing a quick mobile app to tell you the next three buses arriving at a particular stop, but it can be used as the base data for an application that answers those questions and plenty more.
Which style of API should a transit agency provide? Ideally, both ; ) but I recognize that budgets are tight and agencies often much carefully choose how to use their limited IT resources. When forced to make a choice, I always encourage an agency to focus on the low-level API first because it provides the most flexibility to developers in terms of the kinds of applications they can build.
But given lowl-level data APIs like GTFS and GTFS-realtime, can we also make it easy for developers who want to write a quick mobile app that uses transit data? We can!
In the following tutorial, I demonstrate how you can use the OneBusAway application suite to quickly take GTFS and GTFS-realtime data for an transit agency to spin up a powerful web-based API that can be used to easily develop mobile transit apps.
https://github.com/OneBusAway/onebusaway-application-modules/wiki/GTFS-realtime-Quick-Start
Here, GTFS-realtime and OneBusAway provide a nice complement, with GTFS-realtime providing the low-level data interface and OneBusAway providing the high-level application interface, giving us complete coverage of the API spectrum.