Example #1
0
 /// <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);
 }
Example #2
0
 public NamedGeoPoint(string name, GeoPoint point)
 {
     Name = name;
     Point = point;
 }
Example #3
0
 public Entry(double lat, double lon)
 {
     Point = new GeoPoint(lat, lon);
 }
Example #4
0
 public Entry(T item, GeoPoint point)
 {
     Point = point;
     Item  = item;
 }
Example #5
0
 /// <summary>
 /// The distance to a point, see Distance
 /// </summary>
 /// <param name="other"></param>
 public ArcDistance DistanceTo(GeoPoint other)
 {
     return Distance(this, other);
 }