Too small interval in PT transfers

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.

{
“type”: “pt”,
“departure_location”: “Carcavelos”,
“geometry”: {…},
“distance”: 0.0,
“feed_id”: “gtfs_0”,
“is_in_same_vehicle_as_previous”: false,
“trip_headsign”: “Cascais - Cais do Sodré Cais do Sodré”,
“travel_time”: 1590000,
“stops”: […],
“trip_id”: “LCP:27028974”,
“route_id”: “LCP:401”,
“arrival_time”: “2020-08-24T15:44:00.000+0000”,
“departure_time”: “2020-08-24T15:17:30.000+0000”
},
{
“type”: “pt”,
“departure_location”: “CORPO SANTO”,
“geometry”: {…},
“distance”: 0.0,
“feed_id”: “gtfs_0”,
“is_in_same_vehicle_as_previous”: false,
“trip_headsign”: “735 - Hosp. Sta. Maria ALAMEDA D. A. HENRIQUES”,
“travel_time”: 213000,
“stops”: […],
“trip_id”: “LCS:26991318-0”,
“route_id”: “LCS:191142”,
“arrival_time”: “2020-08-24T15:47:55.000+0000”,
“departure_time”: “2020-08-24T15:44:22.000+0000”
},

Is there any way to establish a minimum transfer time?

Thanks

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?

Powered by Discourse