logo separator

[mkgmap-dev] nicer roundabouts

From Gerd Petermann gpetermann_muenchen at hotmail.com on Tue Nov 12 11:29:09 GMT 2013

Hi all,

sorry, I've just noticed that r2819 was based on an out-aged trunk version (2800). Please use
r2821 instead, which is based on r2815.
I am now working on a similar algo for normal roads.


From: gpetermann_muenchen at hotmail.com
To: mkgmap-dev at lists.mkgmap.org.uk
Date: Mon, 11 Nov 2013 11:14:26 +0100
Subject: [mkgmap-dev] nicer roundabouts

Hi all,

I've coded a new algo to detect and remove sharp angles in roundabouts
caused by rounding coordinates to map units.
There are many special cases, but I think it works quite well now.
Please test mkgmap-high-prec-coord-r2819 .

I found two typical problems:
1) Small roundabouts (radius < 10m)  mapped with (too) many points,
this gives ways like in 157324858_o.gpx
2) Large roundabouts (radius > 16m)  mapped with too few points. 

Note that some of these problems cause 
routing problems in the trunk version
but not in the branch.

I've left a lot of debugging messages in the code, so
you should write the sysout to a file (I'll change the 
code to use the logging system later)

I have also left an option --x-gpx-dir=<dir-for-gpx-files> to
create gpx files showing the ways in various stages.
Note that this option produces many small files, so use it only with
one or a few input files.
The gpx files have a name scheme:
[way-id]_o.gpx: original way, once with high precision coordinates,
once with the rounded values
[way-id]_del1_[n]_[pass].gpx: way before a remove-point-action
[way-id]_del2_[n]_[pass].gpx: way after a remove-point-action
[way-id]_m.gpx: final roundabout, once with high precision coordinates,
once with the rounded values, plus map unit grid 

You should not find many of these:
[way-id]_repl_o_[pass].gpx, id]_repl_n_[pass].gpx
way that is connected to a roundabout, and the move of the node causes
a notable change in the angle near the roundabout. 
I found no case where this lead to uglyer angles, typically, the changed
way was closer to the one in OSM .

Open question:
The algo doesn't add points to make a roundabout rounder. It just 
complains like this:
Way http://www.openstreetmap.org/browse/way/136791460: roundabout has rather few distinct points: 9 (radius ~ 17 m)
Way http://www.openstreetmap.org/browse/way/136791476: roundabout has rather few distinct points: 8 (radius ~ 20 m)

Both examples also show why adding points is not a good idea. 
The rule for these messages :
            if (radius < 10.0)
                niceNumSides = 8; 
            else if (radius < 13.0)
                niceNumSides = 12;
            else if (radius < 20.0)
                niceNumSides = 16;
                niceNumSides =  20;
            if (points.size() < niceNumSides){
                if (points.size() < 16)
                    System.out.println(msgPref + ": roundabout has rather few distinct points: " + points.size() + " (radius ~ "+Math.round(radius)+" m)");
                niceNumSides = points.size();

Are these rules okay? Are the messages helpful?


mkgmap-dev mailing list
mkgmap-dev at www.mkgmap.org.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20131112/1cb7caa4/attachment.html>

More information about the mkgmap-dev mailing list