Distance between two Coordinates

Jul 29, 2014 at 10:33 PM
How can I calculate the distance between two coordinates?

How does Google Earth calculate lengths along a LineString?
Does Google's calculation assume the earth is a perfect circle?
Jul 30, 2014 at 8:30 PM
There are some math helpers ported from the C++ library in SharpKml.Base.MathHelpers class, in particular the Distance method might help.

As for how it works I'm not 100% sure to be honest (sounds bad as I wrote it!) but I seem to remember it uses the Great Circle Distance formula.

Hope it helps,
Jul 30, 2014 at 8:40 PM

Thanks for the feedback. I also found some useful looking functions in http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/

Jul 30, 2014 at 9:58 PM

Just to update you on my findings. The MathHelpers Distance indeed uses the simple Great Circle Distance formula (assuming earth is a pure sphere). The http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/ code uses the Vincenty formula with a WGS84 ellipsoid. This produces results that exactly match Google Earth which must also use the WGS84 ellipsoid and the Vincenty formula. I found that the Great Circle formula was resulting in a 2m shorter difference in 700m (which was too great for my application).

It might be worth thinking about incorporating the library above into SharpKml for more accurate distance measurements?