Repository navigation
Description
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
ratrun commentedon Jan 7, 2016
The main problem is that the choosen cycleway segment is tagged as
highway=cyclewayand 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.karussell commentedon Jan 7, 2016
Sorry, I wasn't aware of the chosen vehicle (
bike). The lack of the maxspeed should definitely not prefer this road when using bike.That is indeed a strange route.
we currently do not include turn costs
@ratrun maybe we should prefer routes without any network tags too?
Which one is tagged as cycleway? And the avoided path http://www.openstreetmap.org/way/181280621 is tagged
bicycle=designatedso it should get a priority boost (?)Change highwayspeed for highway=path into the cycleway speed for all …
ratrun commentedon Jan 7, 2016
As expected the problem was that for a
highway=path+bicycle=designatedthe 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=OmniscaleMaybe we should assume
network=lcnin 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.sebalis commentedon Jan 7, 2016
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.)
ratrun commentedon Jan 7, 2016
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.
sebalis commentedon Jan 7, 2016
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’ :-)
karussell commentedon Jan 19, 2016
@sebalis is this tagged in OSM too? E.g. via opposite tags etc?
@ratrun Sounds good.
@ratrun What do you mean here?
@ratrun Yes, please always as separate as possible :)
sebalis commentedon Jan 19, 2016
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.)
karussell commentedon Sep 17, 2016
Is this fixed? (if yes thanks @ratrun for the work in #635)
sebalis commentedon Sep 17, 2016
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!
karussell commentedon Sep 17, 2016
Yes, without '@' I mean the issue creator :)
Perfect - thanks @ratrun !