Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support hail_and_ride / GTFS Flex #156

Open
amenk opened this issue Dec 30, 2019 · 16 comments
Open

Support hail_and_ride / GTFS Flex #156

amenk opened this issue Dec 30, 2019 · 16 comments

Comments

@amenk
Copy link

amenk commented Dec 30, 2019

Are the plans to support GTFS flex and hail_and_ride tagging?

@nlehuby
Copy link
Collaborator

nlehuby commented Dec 30, 2019

I think it would be a good addition to osm2gtfs 👍

But IMHY we should wait for it is fully integrated into the official GTFS spec.

For the record :

@Skippern
Copy link

What is meant by hail_and_ride? Fixed itinerary without fixed stop positions or flexible itinerary? I have seen both solutions, rural bus services in Norway are generally fixed itinerary without fixed stop positions, while some minor places have "taxibus" services where you call a number or via app, and your location + destination is added to current itinerary.

@amenk
Copy link
Author

amenk commented Dec 30, 2019

It's about Addis Ababa minibus service. The routes are fixed, but they let you hop on and off anywhere on that route.

Does OTP support GTFS flex in any way, because that is what we e generating for..

@amenk
Copy link
Author

amenk commented Jan 8, 2020

Does OTP support GTFS flex in any way, because that is what we e generating for..

http://docs.opentripplanner.org/en/latest/Flex/

@amenk
Copy link
Author

amenk commented Jan 12, 2020

For minibus in Addis Ababa it would be

https://github.com/MobilityData/gtfs-flex/blob/master/spec/reference.md#request-stops

3 - Must coordinate with driver to arrange continuous stopping behavior.

continuous_pickup=3
continuous_drop_off=3

in stop_times.txt

@amenk
Copy link
Author

amenk commented Jan 12, 2020

We might need to fork transitfeed, because it does not support that fields

https://github.com/google/transitfeed/blob/master/transitfeed/stoptime.py#L48

@amenk
Copy link
Author

amenk commented Jan 12, 2020

I made some tests with OTP and manually adding to stoptimes.txt

"trip_id","arrival_time","departure_time","stop_id","stop_sequence","stop_headsign","pickup_type","drop_off_type","shape_dist_traveled","timepoint","continuous_pickup","continuous_drop_off"
24,"06:00:00","06:00:00","node/7037142417",1,,,,,,0,0
24,"06:04:54","06:04:54","node/7110438109",2,,,,,,0,0

....

And router-config.jsom

{
  "useFlexService": true,
  "routingDefaults": {
    "flexCallAndRideReluctance": 3,
    "flexMaxCallAndRideSeconds": 7200,
    "flexFlagStopExtraPenalty": 180,
    "flexMinPartialHopLength": 1
  }
}

The flexMinPartialHopLength setting is important.

I get this result:

Selection_261

So it seems to work from a OTP point of view.

We just have to find out how to add those columns in OSM2GTFS

@xamanu Do you see a way without messing with the transitfeed package?

@pantierra
Copy link
Contributor

It could be added somehow in a dirty way with some CSV Manipulation, but I think it would be better to

  • either extend transitfeed with those capabilities and propose these changes as PR to the upstream repository
  • or we might want to consider stopping to rely on transitfeed at all anymore (longer discussion, but there might be some good arguments), and this could bring in this way of flexibility.

@amenk
Copy link
Author

amenk commented Jan 12, 2020

I am wondering if it would be enough to subclass StopTime from Transitfeed.

transitfeed does not seem to care much about PRs ... so we might as well maintain an own fork for OSM2GTFS before completely reinventing the wheel?

@amenk
Copy link
Author

amenk commented Jan 12, 2020

I looks like it's possible to change behaviour of transitfeed with an extension

We could create a class with the following (stub):

from transitfeed.stoptime import StopTime

class FlexStopTime(StopTime):

  _OPTIONAL_FIELD_NAMES = ['stop_headsign', 'pickup_type',
	                   'drop_off_type', 'shape_dist_traveled', 'timepoint',
	                   'continuous_pickup', 'continuous_drop_off']

And call UpdateClass('StopTime', FlexStopTime) on the factory.

Remark:

Simply calling

    feed._gtfs_factory.UpdateClass('StopTime', FlexStopTime)

in osm2gtfs.py does not work (it seems to use a different factory instance later)

@pantierra
Copy link
Contributor

@amenk this is cool. Is there a place where to check the current (not working) state?

@amenk
Copy link
Author

amenk commented Feb 1, 2020

@xamanu Just pushed it - I made some more progress. It's possible with monkey patching to inject the new Factory of the newly created transitfeedflex module https://github.com/AddisMap/osm2gtfs/compare/develop...AddisMap:develop-flex?expand=1

It looked promissing, the flags are in the CSV and I was able to hard-coded set them. But then I did not succeed in passing the flag around to the proper class, if the route is a hail_and_ride route

@pantierra
Copy link
Contributor

Good you got it to work! We really have to rethink how/whether to use transitfeed anymore.

@amenk
Copy link
Author

amenk commented Feb 1, 2020 via email

@amenk
Copy link
Author

amenk commented Feb 2, 2020

now I got it working :-)

AddisMap@b4bf0b9

@amenk
Copy link
Author

amenk commented Feb 2, 2020

#159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants