Calculate transfers.txt to improve routing
prhod opened this issue · 9 comments
Providing transfers information could enhance the use of the generated GTFS for journeys computation.
There could be several ways of doing it :
- a new feature in osm2gtfs
- using an external tool
For information, this self made Rust lib is available : https://github.com/CanalTP/transfe_rs/
Apparently, Navitia's routing algorithm can produce really bad results when transfers.txt
file is missing.
So computing one automatically should be a priority I think.
We should analyze in which way the transfer.txt is related with OSM in order to find a solution for this issue.
Maybe this is one way: take OSM stops related in a Stop Area (not in a station) and fill transfers.txt with the data from stops, and columns transfer_type=2 and min_transfer_time = the frequency of the line.
Example:
Assuming Stop Area X
- stop A (also member of route 1)
- stop B (also member of route 2 and route 3)
- stop C (also member of route 4)
transfers.txt
from_stop_id, to_stop_id, transfer_type
A, B, 2, frequency of route 2
A, B, 2, frequency of route 3
A, C, 2, frequency of route 4
B, A, 2, frequency of route 1
B, B, 2, frequency of route 2
B, B, 2, frequency of route 3
B, C, 2, frequency of route 4
C, A, 2, frequency of route 1
C, B, 2, frequency of route 2
C, B, 2, frequency of route 3
The GTFS transfer information is a walking time between 2 stop points. I don't understand your proposal of using the frequency of the route.
Personnaly, I would use a walking path using OSM ways with a specific walking speed to compute de duration of the transfer. Thou I don't know yet how I would to this ...
As a first step, using a Manhattan distance could be an approximation.
What do you think of that ?
Another option is to test the routes against an instance of OSRM using a walking algorithm, that should give you the shortest legal walking distance and time between any two points. If highway crossings are necessary, Manhattan distances can be wrong.
OSRM is a good idea ! do you know a free of use instance available ?
You're right about highway, the same issue can happen with river. But on the other hand, there is no need for a third part service to generate the GTFS...
Maybe we should start with a simple offline implementation of this and then later maybe introduce different TransfersCreator
s.
I have my own instance of OSRM, its not complicated to set up, so running a private instance is absolutely an option. I havn't tried with a world wide map, downloading and loading Brazil takes about 1.5 hours on my personal lap top, I guess a server would be a little bit quicker.
The GTFS transfer information is a walking time between 2 stop points. I don't understand your proposal of using the frequency of the route.
I was thinking on the transfers.txt
mainly as a way to specify a tansfer between routes, in fact is the way it works if we set transfer_type = 0
. When setting transfer_type = 2
it makes total sense to use walking time in min_transfer_time
, as you say.
My proposal was wrong but just to explain my self: The use of frequency of the route as min_transfer_time
was considered as "kind of" the distance (in time) between one itinerary and the next, so I was thinking on the time the user will "had" for moving from one stop to the other (not the time needed).