How to Read GTFS Data
GTFS (General Transit Feed Specification) is the most widely used standard for sharing public transit schedules and geographic information. If you're working with transit data for the first time, this guide walks you through the structure of a GTFS feed and how to make sense of it.
What is GTFS?
GTFS stands for General Transit Feed Specification. Originally developed by Google and TriMet (Portland's transit agency) in 2005, it has become the global standard for describing public transportation schedules, routes, and stops.
A GTFS feed is a collection of plain-text CSV files bundled into a single ZIP archive. Each file describes a different aspect of the transit system — from what routes exist, to where stops are located, to when services run.
Transit agencies around the world publish GTFS feeds to share their data with trip planners, researchers, and applications like Google Maps. There are over 2,500 publicly available GTFS feeds worldwide.
GTFS Static vs. GTFS Realtime
There are two flavors of GTFS:
- GTFS Static — the scheduled, planned service. This is the ZIP file of CSV data described in this guide.
- GTFS Realtime — live vehicle positions, arrival predictions, and service alerts delivered via Protocol Buffers. This is a separate specification.
This guide focuses on GTFS Static, which is the foundation that GTFS Realtime builds upon.
Key files in a GTFS feed
A GTFS feed can contain up to 17+ files, but most feeds rely on a core set. Here are the most important ones:
| File | Required | Description |
|---|---|---|
agency.txt | Yes | Transit agency name, URL, timezone, and contact info |
routes.txt | Yes | Transit routes (bus lines, subway lines, etc.) |
trips.txt | Yes | Individual trips along each route |
stops.txt | Yes | Physical stop locations with coordinates |
stop_times.txt | Yes | Arrival/departure times at each stop for each trip |
calendar.txt | Conditional | Regular weekly service patterns (Mon–Sun) |
calendar_dates.txt | Conditional | Exceptions to regular service (holidays, special days) |
shapes.txt | No | Geographic path that a vehicle follows along a route |
frequencies.txt | No | Headway-based service instead of exact times |
transfers.txt | No | Rules for transferring between routes at stops |
The required files form the skeleton of any GTFS feed. Without them, a consumer application cannot understand the transit network. The conditional and optional files add richer detail.
How the files connect
GTFS files are relational — they reference each other through ID fields. The core relationship chain is:
An agency operates routes. Each route has many trips (individual journeys). Each trip visits a sequence of stops at specific times defined in stop_times. The calendar files define which days each trip's service runs.
Routes, trips, and stops explained
The distinction between routes, trips, and stops is the key to understanding GTFS. Think of it this way:
- A route is the line itself — for example, "Bus 38" or "Red Line." It has a name, a number, and a type (bus, subway, tram, etc.).
- A trip is a single journey along that route at a specific time. Route 38 might have 200 trips per day — one for each departure.
- A stop is a physical location where passengers board or alight. Stops are shared across routes — the same stop might be served by 5 different bus lines.
Example: reading routes.txt
Here's what a typical routes.txt file looks like:
route_id,agency_id,route_short_name,route_long_name,route_type
R1,agency1,38,Geary,3
R2,agency1,N,Judah,0
R3,agency1,BART-R,Red Line,1
The route_type field tells you what kind of vehicle operates the route: 0 = tram, 1 = subway, 2 = rail, 3 = bus, 4 = ferry, and so on.
Example: reading stop_times.txt
This is typically the largest file in a GTFS feed. Each row is one stop visit on one trip:
trip_id,arrival_time,departure_time,stop_id,stop_sequence
T1001,07:15:00,07:15:00,S100,1
T1001,07:18:00,07:18:00,S101,2
T1001,07:22:00,07:22:00,S102,3
Trip T1001 visits stop S100 first (at 7:15 AM), then S101, then S102. The stop_sequence field ensures the correct ordering even if arrival times are the same.
How to visualize GTFS data
Raw GTFS data is just text files with IDs and coordinates. While you can open them in a spreadsheet, visualizing the data on a map and calendar reveals patterns that are impossible to spot in tabular form:
- Map views show route geometry, stop locations, and how the network connects geographically. You can quickly see coverage gaps, overlapping routes, and network density.
- Calendar heatmaps reveal when service runs — which days have full service, reduced service, or no service at all. This is especially useful for understanding weekend and holiday schedules.
- Stop inspectors let you click on a stop and see every route that serves it, along with arrival frequencies throughout the day.
- Data tables for routes and stops let you browse and search records in a structured format — useful when a feed has hundreds of routes or thousands of stops.
Visualization transforms GTFS from an abstract dataset into something you can understand intuitively — which is why transit planners, researchers, and analysts rely on visual tools when working with feeds.
Using tools like TransitLens
TransitLens is a browser-based GTFS explorer that lets you upload any GTFS feed and immediately see it on an interactive map. You can:
- Browse all routes and see their paths on the map
- Click on individual stops to inspect which routes serve them
- View service calendar heatmaps to understand when trips run
- Filter by route type, agency, or service day
- Explore without installing anything — it runs entirely in your browser
If you're new to GTFS, loading a feed into a visual tool is the fastest way to build intuition about how the data is structured. You'll see the relationships between routes, trips, and stops come to life on the map.
Ready to try it? Open TransitLens and load a GTFS feed to start exploring. You can also open a feed directly from a URL — try loading the MBTA Boston feed to see a real transit network instantly.
For more about how TransitLens works as a complete GTFS exploration tool — including map views, data tables, and calendar analysis — see the GTFS Viewer page. For spatial analysis and map-first workflows, see the GTFS Map Viewer.
See GTFS data in action
Upload any GTFS feed and instantly visualize routes, stops, and service patterns on an interactive map.
Open TransitLens