Is there a way to filter trips that lead through one-way streets or that are only offered in one direction? For example, a bus route that only drives in a circle and not the same route both ways. I work with R, but the question is more about understanding the data structure of GTFS data in general.
I tried to identify these journeys by checking whether the next stop is always the same. I assumed that it must be a one-way trip if the next stop is always the same. Unfortunately, some bus routes change direction during a journey. So the assumption is not always correct. I hoped to find a simple solution in the data itself.
The
trips
table contains adirection_id
field that indicates the direction of travel. Round trips tend to be associated to only one direction, whereas more traditional routes are associated to two.You could, therefore, look for trips that are associated to the same
route_id
and always to the samedirection_id
as well. Another good indicative that they describe the exact same itinerary is to look at theshape_id
they are associated with. If it's the same, that's another indicative that these trips describe the same itinerary that runs always in toward one specific direction.