logo separator

[mkgmap-dev] Resurrect adjust-turn-headings

From Ticker Berkin rwb-mkgmap at jagit.co.uk on Wed Sep 30 17:02:05 BST 2020


Sharp turn-angles impose a route-choosing penalty. For "fastest"
routing this is understandable. However these penalties are so high
that the algorithm might choose to cross the road in question and then
make 2 or 3 opposite turns to finally onto it in the correct direction.
For drive-on:left, it is very costly to turn right and the left turns
are cheap. For the same sharp turn in the other direction I haven't
found any example where it will make the detour.

Building the same map with drive-on:right, it all reverses and you get
the detour when needing to go left.

Somehow these penalties are also applied to "shortest" routing,
resulting in something that is definitely not the shortest route.

Even more weirdly, examples can be found when, switching to "fastest",
the extra costs of the additional turns and journey legs outweigh
single turn cost and this results in a shorter distance that the
"shortest" routing.

Using compactDirs changes the behaviour of all of this. I'm not sure if
this is just because it costs the angle as the maximum of the 22.5
degree segments.

AngleChecker.fixSharpAngles (enabled by default, disabled by --x-ignore
-sharp-angles) attempts to increase angles to lessen this penalty, but
there can be conflicting requirements and sometimes it bends main roads
to lessen more minor road angles and this can cause turn pop-ups.

One of the examples I was working on to try and understand why I was
getting a turn instruction to stay on a trunk/dual-carriageway, I
tracked down to fixSharpAngles increasing the angle between the main
road and the lead-off road, and this was because the lead-off road
wasn't marked as one-way. This isn't obvious in OSM unless you zoom
right in or inspect the tags, so something to watch out for.


More information about the mkgmap-dev mailing list