Transit data guide

How GTFS and GPS Data Become Transit Route Maps

A transit route map is drawn from the schedule data an agency publishes. The moving dot in a rider app comes from a separate GPS feed. Knowing which is which makes the route-map questions on a bus operator hiring test easier to read.

Key takeaways:
  • GTFS Schedule is the plan: routes, stops, trips, stop times and, optionally, the path each trip follows, published as text files in one ZIP.
  • Bus GPS is a separate stream. GTFS Realtime vehicle positions report where a bus is and which scheduled trip it is running.
  • A route-map question tests the plan, not the GPS: route label, both ends, orientation, stop order, and what a map cannot tell you.

What GTFS is

The General Transit Feed Specification (GTFS) is an open standard that transit agencies use to publish their service in a format many software applications can read, according to the GTFS overview on gtfs.org. It has two parts. GTFS Schedule describes planned service. GTFS Realtime carries updates against that plan.

A GTFS Schedule dataset is one ZIP file of mostly plain-text tables. gtfs.org lists the basic set as seven files: agency.txt, routes.txt, trips.txt, stops.txt, stop_times.txt, calendar.txt and calendar_dates.txt. Optional files add detail, such as shapes.txt for the path a vehicle follows. The GTFS Schedule Reference is the source of truth for every field. Google Transit, which ingests these feeds, publishes its own GTFS reference listing the files and fields it ignores or interprets differently, and points back to gtfs.org for the official specification.

Which file becomes which part of the map

GTFS fileWhat it holdsWhat you see on a map
routes.txtA short name such as “32”, a longer descriptive name, a route type (3 means bus), and an optional route colorThe route label and line color
trips.txtOne row per scheduled trip, with the headsign text shown to riders and an optional direction value (0 or 1)The destination you name when you say “toward …”
stops.txtEach stop’s rider-facing name, latitude and longitude; for a bus stop, the pole or boarding pointThe dots along the line
stop_times.txtWhich stops each trip serves, in stop_sequence order, with arrival and departure timesThe order of the stops, and the timetable behind them
shapes.txt (optional)An ordered sequence of points describing the vehicle’s pathThe line that follows the streets
calendar.txt / calendar_dates.txtWhich days each service runs, and the exceptionsWhy a map or timetable carries an effective date

Two details from the reference matter later. The direction value “should not be used in routing”; it exists to separate trips by direction when timetables are published, and can be paired with a headsign such as “Airport” or “Downtown”. And a shape does not have to pass exactly through each stop, but every stop on a trip should lie close to that trip’s shape.

Where the bus’s GPS fits

A bus’s GPS position is not in the schedule ZIP. It travels in a separate feed. GTFS Realtime defines three kinds of update: trip updates (delays, cancellations, changed routes), service alerts (a moved stop, an event affecting a route or the whole network), and vehicle positions.

The vehicle positions entity is described as “automatically generated information on the location of a vehicle, such as from a GPS device on board.” Latitude and longitude are required; bearing, odometer and speed are optional. A position should name the trip the vehicle is serving, and it can say whether the bus is incoming at, stopped at, or in transit to a stop. Google’s GTFS Realtime overview says the feed should be updated regularly, “preferably whenever new data comes in from your Automatic Vehicle Location system.” In that description, the agency’s automatic vehicle location (AVL) system is the source, and GTFS Realtime is how its reports get published.

So the moving dot in a rider app is a position report laid over a map drawn from the schedule, joined by the trip: the position names the scheduled trip, and the schedule supplies that trip’s line and stops. Freight telematics has the same split. A tracker’s breadcrumb trail shows where a unit went, not where it was supposed to go. See how GPS fleet tracking works as a system for that side.

One more distinction matters to anyone applying to drive: location reported to the agency is not navigation for the operator. Calgary Transit’s operator recruitment page, asked “Is there GPS on the bus to help me follow my route?”, answers that its shuttle buses and big buses have none; trainees attend a three-day route knowledge course and are shown how to read and follow a route map and pocket schedule. It adds that its Access buses do have an onboard GPS system, but “city knowledge is still essential.”

How a route map is drawn from the feed

  1. Choose the route. The short and long names in routes.txt become the label.
  2. Split the trips by direction. Headsigns in trips.txt give the destination for each direction. A trip that ends partway along the route can carry its own headsign.
  3. Draw the line. Each trip’s shape_id points to an ordered list of points in shapes.txt. If the two directions use different streets, they have different shapes.
  4. Place the stops in order. Coordinates come from stops.txt; the order comes from stop_sequence in stop_times.txt, whose values must increase along the trip but need not be consecutive.
  5. Add the base map. Streets, rivers and labels come from a separate dataset. The practice maps on TransitPrep, for example, combine agency GTFS for routes, stops and destinations with OpenStreetMap for streets and rivers, and it publishes a list of the agency data sources behind each city’s practice maps.
  6. Date it. The calendar files decide which days each service runs, so a map built from one schedule period can be wrong for the next.

Reading a route map on a bus operator test

Whether you see a map at all depends on the employer and the role. Calgary Transit, for example, lists a map test for Access operators only: a paper-based test that “requires searching a map for answers to questions” using a supplied map booklet. The same page lists interpreting city maps and schedules among operator duties. Other employers assess differently, so check your invitation and the agency’s current posting rather than assuming a format.

When a map question does appear, read the map in the same order the feed builds one:

  1. Label. Route number and name. The long name often includes a destination or a key stop.
  2. Both ends. Find the destinations a bus on this route can show on its sign. Answer direction questions as “toward X” first.
  3. Orientation. Find the north arrow before any compass question. With no arrow, describe direction by destination, not by compass point.
  4. Stop order. Trace the stops in the direction asked. “Next stop” means next in that direction’s sequence, not nearest on the page.
  5. Different streets each way. Where the line splits onto two parallel streets, each direction may use one of them, as on one-way pairs downtown.
  6. Legend and date. Symbols for terminals, transfer points and timepoints, and the date the map applies from.
  7. Limits. A map shows connections, not time. Travel time, frequency and how long a transfer takes come from the timetable, which in a feed lives in stop_times.txt.

To try this on a real route, this step-by-step route-map walkthrough with six practice questions applies the same order to a Winnipeg Transit route drawn from the agency’s open data. For direction choices and connections on a simpler network, there are route-map exercises on choosing a direction and testing a transfer.

Worked example (fictional)

The feed rows below are invented for practice. They do not describe any agency’s service. Route 12 runs between Riverside Loop and Airport Terminal; downtown, it uses Main St toward the airport and King St on the way back.

stop_sequenceTrip 12-A1, headsign “Airport” (direction 0)Trip 12-R1, headsign “Riverside” (direction 1)
1Riverside LoopAirport Terminal
2Main St at 3rd AveBay Rd at Elm St
3Main St at Elm StKing St at Elm St
4Bay Rd at Elm StKing St at 3rd Ave
5Airport TerminalRiverside Loop
  • A bus showing “Airport” has just served Main St at Elm St. Where is its next stop? Bay Rd at Elm St, the next row in that trip’s sequence.
  • Which street does a bus showing “Riverside” use between Elm St and 3rd Ave? King St. The two directions have different shapes, so the Main St stops are served only toward the airport.
  • A bus showing “Riverside” is at Bay Rd at Elm St. Is it heading north? Only if the map has a north arrow and Riverside lies to the north. Without orientation, the supported answer is “toward Riverside”.
  • How long is the ride from Main St at Elm St to Airport Terminal? The map cannot say; that needs the times in stop_times.txt, a timetable. In feed-style times, service after midnight is written as hours above 24: 25:35:00 is 1:35 a.m. the next calendar day.

Where this site fits

This site covers GPS telemetry for trucking and fleet assets. TruckerPro GPS is a private hardware evaluation; it is not a transit AVL system and does not publish GTFS feeds. The transit material above is general background on how location and schedule data become a map.

Related reading

Questions

What is GTFS?

The General Transit Feed Specification, an open standard transit agencies use to publish service data. GTFS Schedule is a ZIP of text files describing routes, stops, trips and stop times; GTFS Realtime carries updates such as delays, service alerts and vehicle positions.

Is a bus’s GPS location part of the GTFS schedule?

No. Positions are published separately, for example as GTFS Realtime vehicle positions, which should name the scheduled trip the bus is serving. The schedule supplies the line and the stops; the position shows where the bus is along them.

Where does the line on a transit route map come from?

When a map is drawn from GTFS, the line comes from the optional shapes.txt file if the agency provides it: an ordered list of points describing the path a vehicle travels. Stops are placed from stops.txt in the order given by stop_times.txt.

Will a bus operator hiring test include a route map?

It depends on the employer and the role. Calgary Transit, for example, lists a paper-based map test for Access operators only. Check your invitation and the agency’s current posting for the assessments that apply to you.

If buses have GPS, do operators still need map skills?

Calgary Transit’s recruitment page says its shuttle buses and big buses have no GPS to help operators follow a route, and trainees are shown how to read and follow a route map and pocket schedule. For its Access buses, which do have onboard GPS, it says city knowledge is still essential.

Share a pilot use case

Tell us what you would track and where it operates. This records interest; it does not place an order.

Join Pilot →