logo separator

[mkgmap-dev] Wrong Douglas-Peucker implementation?

From Gerd Petermann GPetermann_muenchen at hotmail.com on Tue Jun 8 16:34:06 BST 2021

Hi all,

I've noticed that the line simplification in JOSM works different to the one in mkgmap. Both implement a Douglas-Peucker algo, so I wondered why.
It turned out that JOSM calculates the distance of point `px` to the line through(!) end-points `p1` and `p2`, while mkgmap calculates the distance to the segment between(1) those points. So, they get the same distance when the perpendicular is on the segment, but very different values when not.

This page helps to see the difference:  https://karthaus.nl/rdp/

It would be a bit faster to use distToLineSegment() (like JOSM) instead of shortestDistToLineSegment() but I am not sure which result is better.

Any thouhts?

Gerd



More information about the mkgmap-dev mailing list