graphhopper / graphhopper

Open source routing engine for OpenStreetMap. Use it as Java library or standalone web server.

Home Page:https://www.graphhopper.com/open-source/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bike should preffer more footways with bicycle=yes

caspg opened this issue · comments

I noticed that bike profile is preffering tertiary highway instead of footway where bicycle traffic is allowed (bicycle=yes). In my case, it leads to strange route.

Should we lower speed that much if there is bicycle=yes tag in the footway?

         } else if (way.hasTag("bicycle", "designated") || way.hasTag("bicycle", "official") ||
                    way.hasTag("segregated", "yes") || way.hasTag("bicycle", "yes")) {
                // Here we handle the cases where the OSM tagging results in something similar to "highway=cycleway"
                if (way.hasTag("segregated", "yes"))
                    speed = highwaySpeeds.get("cycleway");
                else
                    speed = way.hasTag("bicycle", "yes") ? 10 : highwaySpeeds.get("cycleway");

https://graphhopper.com/maps/?point=54.404198%2C18.624522&point=54.406793%2C18.626314&profile=bike&layer=OpenStreetMap

CleanShot 2024-06-09 at 12 17 29@2x

After changing speed from 10 to "cycleway" speed (18) it routed better:
CleanShot 2024-06-09 at 12 17 09@2x

As long as there is no segregated tag I think that the speed penalty of 8km/h is reasonable compared to the speed you can go on the parallel tertiary road. We need to assume pedestrians and therefore one needs to slow down.

I get that but routing in this case is clearly not ideal. Valhalla and Komoot are using footway in my example.

Can I somehow prioritize that footway with bicycle=yes?

Can I somehow prioritize that footway with bicycle=yes?

We are already prioritizing bicycle=yes with the value PREFER, see BikeCommonPriorityParser

if (way.hasTag("bicycle", "yes") || way.hasTag("bicycle", "permissive"))
pushingSectionPrio = PREFER;

But we are prioritizing tertiary also as PREFER, see

Eventually we should remove this line and additionally change the speed from 10 to 12 or 14. Can you try if this solves your reported example?

@ratrun Removing preferHighwayTags.add("tertiary"); and changing speed to 12 worked!

Should I submit PR with this change?

Should I submit PR with this change?

Yes, I think you should try it. I will support your PR, but we need to convince @karussell. If you do so I recommend to also remove the next line preferHighwayTags.add("tertiary_link"); You need to follow CONTRIBUTING.md. and may add yourself to the CONTRIBUTORS.md file.

#3015 is merged, should this issue be closed?