gtfs-flex
gtfs-flex copied to clipboard
Defining a deviated route
The specification refers to route deviation as follows:
Route deviation services: the vehicle serves a fixed route and ordered set of stops, and may detour to pick up or drop off a passenger between stops.
It is currently not clear how such a route would be defined. For instance, would stop_times.txt
be set up with a single trip that alternates between point stops and a common area zone? Or would the area be at the beginning of the stop sequence with a time span the covers the entire route?
I played around with these scenarios in OTP2 and could not get anything to follow the sequence while allowing for deviation. It would be great to create a sample to be hosted in this repository alongside the existing samples (which I could create with some guidance).
This is the current consensus on how a typical route deviation service looks in a single stop_times.txt trip.
trip_id | arrival_time | departure_time | start_pickup_drop_off_window | end_pickup_drop_off_window | stop_id | stop_sequence | pickup_type | drop_off_type |
---|---|---|---|---|---|---|---|---|
trip1 | 10:00 | 10:00 | -- | -- | stop1 | 1 | 0 | 0 |
trip1 | -- | -- | 10:00 | 10:10 | devationarea_from_stop1_to_stop_2 | 2 | 2 | 1 |
trip1 | -- | -- | 10:00 | 10:10 | devationarea_from_stop1_to_stop_2 | 3 | 1 | 2 |
trip1 | 10:10 | 10:10 | -- | -- | stop2 | 4 | 0 | 0 |
trip1 | -- | -- | 10:10 | 10:22 | devationarea_from_stop2_to_stop_3 | 5 | 2 | 1 |
trip1 | -- | -- | 10:10 | 10:22 | devationarea_from_stop2_to_stop_3 | 6 | 1 | 2 |
trip1 | 10:22 | 10:22 | -- | -- | stop3 | 7 | 0 | 0 |
trip1 | -- | -- | 10:22 | 10:49 | devationarea_from_stop3_to_stop_4 | 8 | 2 | 1 |
trip1 | -- | -- | 10:22 | 10:49 | devationarea_from_stop3_to_stop_4 | 9 | 1 | 2 |
trip1 | 10:49 | 10:49 | -- | -- | stop4 | 10 | 0 | 0 |
Thank you for confirming that, Weston.
One of my attempts was:
trip_id,stop_sequence,stop_id,arrival_time,departure_time,stop_headsign,pickup_type,drop_off_type,continuous_pickup,continuous_drop_off,shape_dist_traveled,timepoint,start_pickup_drop_off_window,end_pickup_drop_off_window,pickup_booking_rule_id,drop_off_booking_rule_id
1,0,1,12:30:00,12:30:00,Fixed Stop 1,,,1,1,0,1,,,,
1,1,flexarea,,,Deviation,2,1,1,1,,,12:30:00,12:45:00,,
1,2,flexarea,,,Deviation,1,2,1,1,,,12:30:00,12:45:00,,
1,3,2,12:45:00,12:45:00,Fixed Stop 2,,,1,1,9563.648972147617,1,,,,
1,4,3,13:00:00,13:00:00,Fixed Stop 3,,,1,1,15517.191158546599,1,,,,
1,5,4,13:15:00,13:15:00,Fixed Stop 4,,,1,1,25636.93707457991,1,,,,
Where 1
, 2
, 3
, 4
are normal stops and flexarea
is defined in locations.geojson
to cover a region containing all the stops. This results in using the flexarea
to travel all the way to the destination, even though it is outside the time and the area (near the last stop). The same occurs when placing the area around only the second stop. So the problem appears to be OTP2 support rather than a misapplication of the spec.
🙏 Thanks for the suggestion of adding a data example for deviated route, we plan to create a page to show flex data example on gtfs.org, and will include at least 1 deviated route example, after flex is officially adopted.
📨 Also, I invite you to participate in the following PR #388 GTFS-Flex. I believe that your input would be valuable and you would remain up to date on the upcoming official adoption of Flex extension into the spec.