<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Roger,<br><br>the problem is caused by the routine that removes obsolete points from straigt lines. <br>This routine doesn't care (enough) about the spherical distortian.<br>The routine uses herons formula to "calculate distance of point in the middle to line c1,c2".<br>This formula is for 2D, but used to work good enough with the rather short ways <br>we have in OSM. (The formula is also used in the Douglas-Peucker filter).<br>With long lines the as in your data, the errors are too big and the routine returns garbage.<br><br>If I got that right, we have to use the formula for the "Cross-track distance" as described here:<br>http://www.movable-type.co.uk/scripts/latlong.html<br>&nbsp; <br>Unfortunately, this routine uses more trigonometrical calculations, so it will be slower.<br><br>@Programmers: Any other ideas?<br><br>Gerd<br><br><div><hr id="stopSpelling">Date: Wed, 25 Jun 2014 12:12:18 +0100<br>From: roger@rogercalvert.me.uk<br>To: mkgmap-dev@lists.mkgmap.org.uk<br>Subject: [mkgmap-dev] Incorrect compilation of grid lines<br><br>
  

    
  
  
    I have a file containing the British National Grid lines, as printed
    on Ordnance Survey maps. This can be found at <a href="http://www.rogercalvert.me.uk/osm/GBGrid/GBGrid.zip" target="_blank">http://www.rogercalvert.me.uk/osm/GBGrid/GBGrid.zip</a>
    (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.<br>
    <br>
    This works correctly with mkgmap 2654 and It displays correctly in
    JOSM.<br>
    <br>
    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.<br>
    <br>
    (I have not used any versions of mkgmap in between these two). <br>
    <br>
    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
    lines.<br>
    <br>
    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.<br>
    <br>
    I would greatly appreciate any advice.<br>
    <br>
    Many thanks,<br>
    <br>
    Roger<br>
    <div class="ecxmoz-signature">-- <br>
      <hr style="width:50%;"><br>
      Roger Calvert<br>
      <a href="http://www.rogercalvert.me.uk" target="_blank">http://www.rogercalvert.me.uk</a><br>
      <hr style="width:50%;"></div>
  

<br>_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</div>                                               </div></body>
</html>