Ramer-Douglas-Peucker Algorithm with GPS

1.5k views Asked by At

I have GPS data which can be close to the north/south pole and can move thousands of kilometers.

If I build a distance matrix for example with:

from geographiclib.geodesic import Geodesic

p1_lat, p1_lon = 43.374880, -78.119956
p2_lat, p2_lon = 43.374868, -78.119666
geod = Geodesic.WGS84

g = geod.Inverse(p1_lat, p1_lon, p2_lat, p2_lon)

print("Distance is {:.2f}m".format(g['s12']))

Can I apply the Ramer-Douglas-Peucker Algorithm on it ?

I always see an array of x, y coords as an input of the RDP algorithm but in my case the transformation which preserve the distances doesn't exist.

1

There are 1 answers

0
Steven Laan On

Cheesy answer: Yes, you can apply the algorithm. However, the output is probably not what you want...

My assumption is that you want to simplify GPS trajectories that are close to either of the poles. (Which screws up the Ramer-Douglas-Peucker cause the coordinates jump all over the place)

There is a body of research dedicated to simplifying trajectories for different applications. For example does it matter if height/altitude is preserved? Is speed important (as in speed along the trajectory)?

There are specific algorithms for such cases.

An easy approach, that does probably deal awfully with considerations mentioned above, is to just convert lat/long into X-Y-Z coordinates and then apply the RDP algorithm.

(See this answer for how to convert to XYZ: Answer from Stephen Quan)