Avoid 90 degree turns on single way

Hello,

Is there a way to detect and avoid sharp turns that occur on a single way? I’m encountering an issue with the following path:

:link: Way: 1148573586 | OpenStreetMap

This way is tagged with "footway" and "bicycle=yes", which causes it to be promoted by BikeCommonPriorityParser due to this logic:

if (pushingSectionsHighways.contains(highway) || "parking_aisle".equals(way.getTag("service"))) {
            PriorityCode pushingSectionPrio = SLIGHT_AVOID;
            if (way.hasTag("highway", "steps"))
                pushingSectionPrio = BAD;
            else if (way.hasTag("bicycle", "yes") || way.hasTag("bicycle", "permissive"))
                pushingSectionPrio = PREFER;
            else if (isDesignated(way))
                pushingSectionPrio = VERY_NICE;

As a result, the priority becomes PREFER. I understand I could lower this using a custom model, but in general, I want to keep the footway + bicycle=yes combo as preferred—except in cases where it leads to sharp, awkward turns like this.

Interestingly, when planning a similar route using the GraphHopper website:

:link: GraphHopper Maps | Route Planner

…it correctly avoids this problematic path.

I also tried enabling TurnCosts, but it didn’t seem to have any effect—probably because this is a single way, possibly represented by a single edge?

Is there any recommended approach to detect or penalize such turns within a single way?

Thanks!

You can have a look into the curvature encoded value which stores the beeline distance divided by the real distance and should be much smaller than 1 for this case.

enabling TurnCosts

This is not really “a turn” in the graph sense. It is only a turn if a node (junction) is involved.

Curvature worked, thanks!

1 Like