Public transit & GTFS
Timetables as data: GTFS feeds, service calendars, frequency, transit travel times and the realtime feeds that correct them.
A transit feed is a timetable stored as a database. Routes are labels, trips are journeys, and the times live in one enormous table that only makes sense once a calendar has said which dates each trip runs on. Every question here — how often, how far, how many people — is a join across four or five files, and the calendar is the one most often skipped.
What makes the subject hard is time. A GTFS time can read 25:10:00, a holiday can remove one timetable and add another, and the travel time between two places depends on the minute you leave, because missing a bus by a minute costs its whole headway. Almost every error in this topic is a number that looks reasonable: a frequency counted across both directions, a catchment drawn as a circle, a travel time taken from the best departure of the hour.
The concepts below cover the feed, its calendar, headways and accessibility; the how-to guides read, clip, map and route across a real feed; and the fixes are filed under the symptom — times past midnight, empty dates, straight-line routes and travel times that flatter the network.
🧭 Start with the concepts
The ideas the how-to guides below assume you already have.
- GTFS explained: the tables behind every transit feed
- GTFS service calendars explained: calendar, calendar_dates and the service day
- Transit frequency and headways explained
- Transit accessibility explained: why travel time depends on the minute you leave
- GTFS Realtime explained: trip updates, vehicle positions and alerts
⚙️ Then do the task
Step-by-step walkthroughs with code you can copy and adapt.
- How to read a GTFS feed in Python
- How to find the trips running on a given date in GTFS
- How to map transit routes and stops from GTFS shapes
- How to calculate service frequency at every stop from GTFS
- How to clip a GTFS feed to a study area
- How to build walking catchments around transit stops
Show every how-to guide in this topic
- How to compute transit travel times from GTFS in Python
- How to draw a transit isochrone from a GTFS feed
- How to measure the population served by frequent transit
- How to read GTFS Realtime vehicle positions and delays in Python
- How to Animate Transit Vehicles from a GTFS Schedule in Python
- How to Map Bike-Share Trips as Flows in Python
- How to Build Desire Lines from Origin–Destination Data in Python
- How to Measure Crime Around Transit Stations in Python
🔧 When it breaks
The errors this topic produces, with the cause explained rather than just the command.
Learning paths through this topic
A curated route rather than a list — the guides in the order that builds on itself.
Related topics
Subjects that keep coming up alongside this one, most overlap first.