I use this function below to find the distance between two sets of latitude and longitude pairs. It seems to work fine but I have two questions. It returns the value in kilometers and not in miles (I'm in the USA), and it seems that the value in kilometers is shifted by three decimal places? The returned values โโlook something like this: 34366.7661043296 - the distance from Valencia, California, to Burbank, is about 35 kilometers. Why in kilometers, and most importantly, why decimal? It would be great if he just returned something like 36.50 miles. Any help is greatly appreciated, thanks in advance.
public static double GetDistance(double sLatitude, double sLongitude, double eLatitude, double eLongitude) { var sCoord = new GeoCoordinate(sLatitude, sLongitude); var eCoord = new GeoCoordinate(eLatitude, eLongitude); return sCoord.GetDistanceTo(eCoord); }
source share