What Role Does stop_times.txt Play in GTFS?
From the earlier reference collection. Read the current software blog.
stop_times.txt links a trip to its ordered stops and scheduled passage times, allowing a consumer to reconstruct its stop-level itinerary.
It provides the sequence for a trip
The route name alone does not say which locations a particular vehicle run visits or when it reaches them. In GTFS, stop_times.txt supplies the stop-level records associated with a trip. Each record connects a trip to a stop and includes a sequence position, with schedule times where provided. The trip identifier ties these rows together; the stop identifier connects each row to the location described in stops.txt.
Order records by stop sequence
To reconstruct a run, select rows for one trip and order them by stop_sequence. Do not rely on the order in which rows happen to appear in the file. The sequence expresses the intended order along the trip, while the referenced stop provides the location details. For example, trip T8 might have rows for stop C at sequence 1, stop D at sequence 2, and stop E at sequence 3. Sorting those rows produces the itinerary even if the source file lists them in a different order.
Arrival and departure values describe scheduled passage at the stop. Depending on the schedule and stop, the values can coincide or differ. A consumer should retain the distinction when displaying dwell or timing information rather than assuming that every stop has an identical arrival and departure.
Use the chain to answer practical questions
Suppose a rider asks whether a trip reaches stop D before stop E. The consumer finds T8’s stop-time rows, sorts the sequence, resolves D and E through stops.txt, and compares their scheduled times. To find trips serving D, it can search for stop-time rows referencing D and then follow each trip’s route and service information. These are joins across related records, not searches for matching route text.
The file also supports checks for missing references and implausible sequence order. A row pointing to an unknown trip or stop cannot be interpreted reliably until the inconsistency is resolved.
Keep schedule meaning attached to the service date
A time in stop_times.txt belongs to the trip’s service-day context. For a trip continuing after midnight, a value can exceed 24:00:00, so a consumer should not reject it merely because it is later than a normal clock day. To present a local clock time, combine the schedule with the applicable service date and the feed’s service-day convention. The GTFS reference defines stop_times.txt among the dataset files and explains that service days can extend beyond 24 hours.