//From https://www.movable-type.co.uk/scripts/latlong.html public static double GetDistanceInMeter(GPSLocation location1, GPSLocation location2) { const double radius = 6371000; var latRad1 = ToRadians(location1.Latitude); var latRad2 = ToRadians(location2.Latitude); var deltaLat = ToRadians(location2.Latitude - location1.Latitude); var deltaLong = ToRadians(location2.Longitude - location1.Longitude); var a = Math.Sin(deltaLat / 2) * Math.Sin(deltaLat / 2); a += Math.Cos(latRad1) * Math.Cos(latRad2) * Math.Sin(deltaLong / 2) * Math.Sin(deltaLong / 2); var c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a)); var d = radius * c; return(d); }
public bool Equals(GPSLocation other) { return(Longitude.Equals(other.Longitude) && Latitude.Equals(other.Latitude)); }