Skip to content

Odd choices in bicycle routing, perhaps due to 50 km/h limit on some of the involved segments #634

Closed

Description

@sebalis

Hi, as requested by @karussel in the thread after https://twitter.com/SebaLis/status/684729267419234304 I have this to report:

On a local road, Graphhopper makes some strange choices in bicycle routing. This is a large inner-city road, dual carriageway and part of a German “B” road but still a city road that is not grade-separated, intersects with all roads and has a pavement that is partly a cycle lane next to it. In OSM it’s modelled as two ways for the two directions tagged with highway:secondary and oneway:yes, and a maxspeed:50 tag. The pavement and cycle lane is modelled as one and the same sequence of ways having both the foot:designated and bicycle:designated tags.

https://graphhopper.com/maps/?point=52.022785%2C8.528824&point=52.019959%2C8.526238&locale=en&vehicle=bike&weighting=fastest&elevation=true&layer=Omniscale shows that a bicycle routing on the road from one crossing to the third-next one branches off the road at an intermediate crossing using lanes that are actually intended only for turning into a residential road and back from that road into the main one. These are segments marked highway:residential and oneway:yes but with no speed limit (of course the regular 50 km/h speed within German cities still applies, I suppose the limit is there on the main road because in some rare cases a 70 km/h applies to main city roads).

When the start and end positions are moved from the road to the pavement/cycle lane as shown in https://graphhopper.com/maps/?point=52.022844%2C8.528749&point=52.019986%2C8.526099&locale=en&vehicle=bike&weighting=fastest&elevation=true&layer=Omniscale the routing still tries to use these residential segments and ends up with an even more nonsensical path.

@karussell speculated on Twitter that the missing speed limit was what made these segments so popular for Graphhopper’s cycle routing. But that does not make much sense as a) bicycles should not avoid a road with a 50 km/h limit and b) using these two short segments ends up with a longer and non-straight overall route, particularly in the second case, and that extra length and the required turns should outweigh the advantage of hypothetically being faster than 50 km/h on these short segments. Also, the pavement/cycle lane that is used in the second case does not have a speed limit either of course and is also a more direct route than the solution that is returned.

Activity

  1. ratrun commented on Jan 7, 2016

    @ratrun
    Contributor

    The main problem is that the choosen cycleway segment is tagged as highway=cycleway and the other way as path. For path we assume a lower speed. An additional small thing I noticed is a small tagging problem in relation 2418376: This cycle route does not include any network tag.

  2. karussell commented on Jan 7, 2016

    @karussell
    Member

    @karussell speculated on Twitter that the missing speed limit was what made these segments so popular for Graphhopper’s cycle routing.

    Sorry, I wasn't aware of the chosen vehicle (bike). The lack of the maxspeed should definitely not prefer this road when using bike.

    the routing still tries to use these residential segments and ends up with an even more nonsensical path.

    That is indeed a strange route.

    the required turns should outweigh the advantage

    we currently do not include turn costs

    http://www.openstreetmap.org/relation/2418376#map=18/52.02103/8.52824

    @ratrun maybe we should prefer routes without any network tags too?

    The main problem is that the choosen cycleway segment is tagged as highway=cycleway and the other way as path.

    Which one is tagged as cycleway? And the avoided path http://www.openstreetmap.org/way/181280621 is tagged bicycle=designated so it should get a priority boost (?)

  3. ratrun commented on Jan 7, 2016

    @ratrun
    Contributor

    As expected the problem was that for a highway=path + bicycle=designated the guessed speed was 12km/h, while for a 'highway=cycleway' 18km/h were assumed. Fixed with #635, which also fixes the reported case. Here is the link, because above the link was incorrect: http://127.0.0.1:8989/?point=52.022844%2C8.528749&point=52.019986%2C8.526099&locale=en&vehicle=bike&weighting=fastest&elevation=true&layer=Omniscale

    maybe we should prefer routes without any network tags too?

    Maybe we should assume network=lcn in this case. But I found a few cases in the past where the mapper intended to map a 'mtb' relation. Shall I add this change to PR #635? I would prefer a separate PR for this.

  4. sebalis commented on Jan 7, 2016

    @sebalis
    Author

    I can’t see this yet, can I? (By the way, the query string in the link you gave is identical to my second example. The URL before the query string is obviously from a development installation and inaccessible to me, so I assume that the change in that part is not what you’re referring to when you say the above link was incorrect.)

  5. ratrun commented on Jan 7, 2016

    @ratrun
    Contributor

    I can’t see this yet, can I?

    No you cannot see this on the official server. This takes least three steps. First the change needs to get reviewed, then merged, then deployed and then the graph needs to get re-build with the active change.

  6. sebalis commented on Jan 7, 2016

    @sebalis
    Author

    I see. Thanks for your work! By the way, looking back at the OSM data, I have found the cycleway segment with highway=cycleway that you were referring to. But there's another argument against using that segment irrespective of estimated speeds: the old route would use this segment against the normal flow of traffic. Not sure whether you can and want to make this part of your routing decisions, just sayin’ :-)

  7. karussell commented on Jan 19, 2016

    @karussell
    Member

    the old route would use this segment against the normal flow of traffic.

    @sebalis is this tagged in OSM too? E.g. via opposite tags etc?

    Maybe we should assume network=lcn in this case.

    @ratrun Sounds good.

    But I found a few cases in the past where the mapper intended to map a 'mtb' relation.

    @ratrun What do you mean here?

    Shall I add this change to PR #635? I would prefer a separate PR for this.

    @ratrun Yes, please always as separate as possible :)

  8. sebalis commented on Jan 19, 2016

    @sebalis
    Author

    The segment I was writing about does not have be tagged via opposite etc – it’s on the other side of the road, so it’s not supposed to be used in the direction that this route uses it in. (I’m talking about the secound route in my original report, which goes to the other side of the main road for a while before returning to the other side at the crossing near the end and then backs up to the destination point, again against the flow of traffic on the original side of the main road.)

  9. karussell commented on Sep 17, 2016

    @karussell
    Member

    Is this fixed? (if yes thanks @ratrun for the work in #635)

  10. sebalis commented on Sep 17, 2016

    @sebalis
    Author

    Not sure if that question was directed at me, but I checked: in my example the data seems to have not been significantly changed and the routing has been fixed. Thank you @karussell and @ratrun!

  11. karussell commented on Sep 17, 2016

    @karussell
    Member

    Yes, without '@' I mean the issue creator :)

    Perfect - thanks @ratrun !

  12. added this to the 0.7 milestone on Sep 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions