/// <summary> /// Calculate the distance between 2 points along the surface of the earth using the haversine formula /// </summary> public static ArcDistance Distance(GeoPoint a, GeoPoint b) { a = a.ToRadians(); b = b.ToRadians(); double u = Math.Sin((b.Latitude - a.Latitude) / 2); double v = Math.Sin((b.Longitude - a.Longitude) / 2); var radians = 2.0 * Math.Asin(Math.Sqrt(u * u + Math.Cos(b.Latitude) * Math.Cos(a.Latitude) * v * v)); return new ArcDistance(radians); }
public NamedGeoPoint(string name, GeoPoint point) { Name = name; Point = point; }
public Entry(double lat, double lon) { Point = new GeoPoint(lat, lon); }
public Entry(T item, GeoPoint point) { Point = point; Item = item; }
/// <summary> /// The distance to a point, see Distance /// </summary> /// <param name="other"></param> public ArcDistance DistanceTo(GeoPoint other) { return Distance(this, other); }