I'm trying to build a data store for the GFTS static data, but can't get my head around the relationships between Route, Stop, Stop_Times and Trips.

Route 2E runs between airport and city centre. It has a fixed number of stops on this route. An instance of the 2E is a trip which leaves the airport at a certain time (9:30) to travel to the city. Its Stop times are the times that this trip specifically will be at designated stops.

However, this implies a link between Route and Stops. Route 2E has 12 stops between Airport and city. This never changes regardless of whether you catch the 9:30 trip or 11:30 trip.

So Stop Times are linked to Trip. But stops should linked to Routes. But every data model I have seen does not show the route stop relationship.

What am I missing ?


3 Answers 3


The same Routes can have different stops, depending on the trip. For example, the trip A goes from airport to city, and trip B goes from airport, to shopping center, then to city. The route's trips have most of the same stops, but some of the trips may have more or less than other ones. It makes more sense to link stop to trip because that is the determination whether a bus stops there or not.

the stops may have all the trips of a route stop there such as the airport, but a stop may have a few trips of a route stop there such as the shopping center.


The trip.txt file has a trip_id field in it. The stop_times.txt forms the relation because it also has a trip_id field in addition to a stop_id field, which links it to the stops.txt file.

Finally, the trips.txt also has the route_id field and this is how it links to the routes.txt file. A route can be made of many trips.


Routes.txt file provides route names serviced by carrier.

Stops.txt file provides stops and corresponding geographic coordinates serviced by a carrier.

Trips.txt file provides all the trips serviced under a route, depending on service_type(e.g. special day, holiday) and it also holds geographical shape id information using which you can render the trip.

Stop_times file provides the trip timings associated with the stop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.