Hi there,
I have seen many examples in various programming languages that are using the Douglas-Peucker polyline simplification algorithm to produce a GPolyline to be used on Google Maps. The algorithm, when expressed for polylines on a plan, involves the calculation of the distance between a point and a line (passing through two other points).
Now all the examples I have seen so far are applying the algorithm in a very naïve way, simply by replace x and y by the latitude and longitude. This may produce acceptable results as long as the polyline is very localized, not too close to a pole, and does not cross the 180° meridian, but I would like to implement a more general version of the algorithm.
So, If I am not mistaken, I would need to compute the length of the shortest arc on the surface of a sphere, from a point to the circle passing through two other points of the surface of the sphere, the center of which coinciding with the center of the sphere (the earth).
Does anyone know the formula that computes this length?
Thanks in advance