[Patch v1] improve filters to reduce artifacts in shapes at lower resolutions

Hi all, attached is a patch that addresses the following problem: When you use e.g. GPSMapEdit to look at the polygons produced by mkgmap for resolutions < 24, you may notice e.g. white triangles in the ocean where there should be water. I am not sure if they are visible in Basecamp or MapSource or a Garmin device, but they are not intended and they sometimes "confuse" the optimization filters. They are produced when the Douglas-Peucker-Filter removes points which are somehow important. Important points are 1) Those that lie on the bounding box of the polygon 2) Points which connect a hole with the outline Another problem was The patch changes the code so that these points are preserved before line simplification is applied. It also makes sure that the result doesn't depend on the order in which the shapes are processed. You may see small changes in img size, sometimes size is decreased, sometimes increased (more likely). If you see changes > 10 kB on a single img file compared to r3683, please post a link to the corresponding input file. If I hear no complains I'll commit this patch next Monday. A binary for testing is here: http://files.mkgmap.org.uk/download/303/mkgmap.jar Gerd

Hi Gerd, a bit off-topic but similar problem. Could you apply important points to line objects too? Important points would be points, where line objects are crossed. I think you already find important points for roads on routable map and layer 0. You could preserve them on upper layers. And maybe would be possible to find important points for other line objects too. The reason for this is that simplification doesn't preserve line crossing. For example T-like crossroad can become 2 separate lines. This is mostly invisible, but looks bad when spotted. -- Best regards, Andrzej

Hi Andrzej, I think the current code marks all road junctions, this should also work at lower resolutions. Can you give an example node where it doesn't work? Maybe this happens with overlay lines ? Gerd ________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej@poczta.onet.pl> Gesendet: Mittwoch, 27. Juli 2016 18:03:22 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] [Patch v1] improve filters to reduce artifacts in shapes at lower resolutions Hi Gerd, a bit off-topic but similar problem. Could you apply important points to line objects too? Important points would be points, where line objects are crossed. I think you already find important points for roads on routable map and layer 0. You could preserve them on upper layers. And maybe would be possible to find important points for other line objects too. The reason for this is that simplification doesn't preserve line crossing. For example T-like crossroad can become 2 separate lines. This is mostly invisible, but looks bad when spotted. -- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Gerd, it is an old problem for me and I haven't looked at it for some time. I have tested now and I see that layer 0 is correct regardless of routing or not. But still no preservation of important points for upper layers, I get roads like on attached picture - default style, no specific options, layer 1 - 23 bits. Screenshot from GPSMapEdit. Since you corrected upper layers for polygons, I hope you could easily do the same for roads. -- Best regards, Andrzej

Hi Andrzej, ahh, yes, the problem is that mkgmap ignores the preserved points here, see I introduced that change in r2773 in the reduce_limits branch. I am not sure why I did that, maybe I was more interested in img size than in line distortion or I did not like the effect of preserved points in some cases. I'll try to find out... Gerd ________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej@poczta.onet.pl> Gesendet: Freitag, 29. Juli 2016 21:33:34 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] [Patch v1] improve filters to reduce artifacts in shapes at lower resolutions Hi Gerd, it is an old problem for me and I haven't looked at it for some time. I have tested now and I see that layer 0 is correct regardless of routing or not. But still no preservation of important points for upper layers, I get roads like on attached picture - default style, no specific options, layer 1 - 23 bits. Screenshot from GPSMapEdit. Since you corrected upper layers for polygons, I hope you could easily do the same for roads. -- Best regards, Andrzej
participants (2)
-
Andrzej Popowski
-
Gerd Petermann