onebusaway-application-modules icon indicating copy to clipboard operation
onebusaway-application-modules copied to clipboard

schedule-for-stop GTFS pickup_type and drop_off_type not considered in scheduleStopTimes departureEnabled and arrivalEnabled

Open lubbo opened this issue 8 years ago • 2 comments

In the scheduleStopTimes of the schedule-for-stop, the fields arrivalEnabled and departureEnabled are computed only on the basis of the block sequence in the whole block stop times.

in org.onebusaway.transit_data_federation.impl.beans.StopScheduleBeanServiceImpl

stiBean.setArrivalEnabled(bst.getBlockSequence() > 0); stiBean.setDepartureEnabled(bst.getBlockSequence() + 1 < blockConfig.getStopTimes().size());

But the specific entry in stop_time.txt can detail if the stop allow pickUp and dropOff with columns pickup_type and drop_off_type

See: https://developers.google.com/transit/gtfs/reference/#stop_timestxt

In case pickup_type == 1 the departureEnabled should be false and in case drop_off_type == 1 the arrivalEnabled should be false

This is my use case: http://transitfeeds.com/p/actv/631/latest/trip/5672

The last stop in "P.le Roma (S. Chiara) "G"" doesn't allow to pickup: the boat ends its journey, all people are dropped off and it pickups from another stop.

Proposed solution (PR WIP)

boolean firstStopTimeInBlock = ( bst.getBlockSequence() == 0 ); boolean dropOffEnabled = (sti.getStopTime().getStopTime().getDropOffType() != 1 ); boolean lastStopTimeInBlock = ( bst.getBlockSequence() + 1 >= blockConfig.getStopTimes().size() ); boolean pickupEnabled = (sti.getStopTime().getStopTime().getPickupType() != 1 );

stiBean.setArrivalEnabled( dropOffEnabled && !firstStopTimeInBlock ); stiBean.setDepartureEnabled( pickupEnabled && !lastStopTimeInBlock );

lubbo avatar Oct 11 '17 10:10 lubbo

Thanks. I'm going to get another set of eyes on this, but it looks good to me.

sheldonabrown avatar Oct 11 '17 10:10 sheldonabrown

We are successfully using this patch to prevent displaying buses that arrive at a stop to drop off passengers but not pick up any new passengers. This has been tested against 1.1.18 and 1.1.19.

MichaelNeuman-COM avatar Mar 21 '19 16:03 MichaelNeuman-COM