I’ve been having some problems with the PT routing but have been able to get around them. This one is tricky though.
In this particular case, the departure time of the second transport is just 44 seconds after the arrival time of the first transport, and since the stops aren’t really that close, it would be impossible in a real life scenario to do that transfer on time.
Just noticed transfers.txt specifically states a min_transfer_time of 303 seconds for a transfer between those two stops, which is clearly not being respected. Is this a bug?
I believe I fixed the issue. The transfers.txt parsing is fine, min_transfer_time gets saved in memory. However, when adding the transfers to the departure timeline (insertInboundTransfers function in GtfsReader.java), every transfer object has min_transfer_time value 0. I traced the problem back to getTransfersToStop function in Transfers.java.
In the GTFS data I used, transfers.txt only has from_stop_id, to_stop_id, transfer_type and min_transfer_time info. For that reason, the condition hasNoRouteSpecificArrivalTransferRules(fromStop) is always true and thus the min_transfer_time never gets assigned for the Transfer objects being returned to insertInboundTransfers function in GtfsReader.java.
My solution is just assigning the min_transfer_time in the transfers array (which always has only one item in my case, there is always only 1 transfer between two stops):
if (hasNoRouteSpecificArrivalTransferRules(fromStop)) {
Transfer myRule = new Transfer();
myRule.from_stop_id = fromStop;
myRule.to_stop_id = toStopId;
// NEW CODE
if(transfers.size() == 1)
myRule.min_transfer_time = transfers.get(0).min_transfer_time;
// END OF NEW CODE
result.add(myRule);
}
I can fork these changes to the repo, but first I’d like to know if this doesn’t break anything. Is this supposed to be like this or is it something that you missed? What is exactly the purpose of the hasNoRouteSpecificArrivalTransferRules(fromStop) condition?