logo separator

[mkgmap-dev] Incorrect compilation of grid lines

From Gerd Petermann gpetermann_muenchen at hotmail.com on Fri Jul 25 09:46:39 BST 2014

Hi Roger,

the problem is caused by the routine that removes obsolete points from straigt lines. 
This routine doesn't care (enough) about the spherical distortian.
The routine uses herons formula to "calculate distance of point in the middle to line c1,c2".
This formula is for 2D, but used to work good enough with the rather short ways 
we have in OSM. (The formula is also used in the Douglas-Peucker filter).
With long lines the as in your data, the errors are too big and the routine returns garbage.

If I got that right, we have to use the formula for the "Cross-track distance" as described here:
Unfortunately, this routine uses more trigonometrical calculations, so it will be slower.

@Programmers: Any other ideas?


Date: Wed, 25 Jun 2014 12:12:18 +0100
From: roger at rogercalvert.me.uk
To: mkgmap-dev at lists.mkgmap.org.uk
Subject: [mkgmap-dev] Incorrect compilation of grid lines


    I have a file containing the British National Grid lines, as printed
    on Ordnance Survey maps. This can be found at http://www.rogercalvert.me.uk/osm/GBGrid/GBGrid.zip
    (this contains two files, they are the same except for the addition
    of the 'version' tag in the GBGrid06.osm file). I compile this file
    with mkgmap and overlay it on my GPS map.


    This works correctly with mkgmap 2654 and It displays correctly in


    With mkgmap version 3241, the lines are misaligned and out of
    position. The behaviour is the same on MapSource, BaseCamp and my
    device. No error messages are produced.


    (I have not used any versions of mkgmap in between these two). 


    My style file allocates codes in the 0x10300 range to these lines,
    but the effect is the same when I use code 0x21 (contour) for all


    Attached are screen dumps for a small part of the map, from JOSM,
    mkgmap 2654 and mkgmap 3241, and also the batch file I used to
    compile it.


    I would greatly appreciate any advice.


    Many thanks,





      Roger Calvert



mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20140725/69e6db22/attachment-0001.html>

More information about the mkgmap-dev mailing list