Finding distance between 2 lat longs

Topics: Algorithms
May 15, 2007 at 1:53 PM
Hi, I'd like to use the distance functions between two lat lon points but get distance in degrees rather than a more convenient distance such as metres. How do I use the SharpMap libraries to get the distance expressed as a linear unit between two points expressed as an angular unit? Thanks for any pointers.... Gavin
May 16, 2007 at 8:39 AM

if you have the distance in degrees you can convert those to metres by yourself using the following methods:

/// <summary>
/// Degrees to radians.
/// </summary>
/// <param name="degree">Value in degrees.</param>
/// <returns>Value in radians.</returns>
private static double DegreesToRadians(double degree)
return degree * Math.PI / 180.0;

/// <summary>
/// Converts radians to meters.
/// </summary>
/// <param name="radians">Value in radians.</param>
/// <returns>Value in meters.</returns>
private static double RadiansToMeters(double radians)
// there are 1852 meters in a nautical mile
// Radians to Nautical Miles: radians * 60 * 180 / Math.PI

return 1852 * (radians * 10800 / Math.PI);

Hope that helps.

May 16, 2007 at 1:05 PM
Thanks! I've also just discovered this page
with the Haversine formula that seems to give results.

Thanks for the quick response,