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