Exemplo n.º 1
0
 /// <summary>
 /// Finds the destination from a source using a rhumb line
 /// </summary>
 /// <param name="latitude">The source latitude</param>
 /// <param name="longitude">The source longitude</param>
 /// <param name="bearing">The bearing to the destination</param>
 /// <param name="distance">The distance away from the source</param>
 /// <param name="distanceType">The unit of measure that the distance is provided in</param>
 /// <returns>The destination</returns>
 public static ICoordinate FindRhumbDestination(Latitude latitude, Longitude longitude, double bearing, double distance, DistanceType distanceType)
 {
     return(FindRhumbDestination(new GeoCoordinate(latitude, longitude), bearing, distance, distanceType));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new GeoCoordinate
 /// </summary>
 /// <param name="latitude">The coordinate latitude</param>
 /// <param name="longitude">The coordinate longitude</param>
 public GeoCoordinate(Latitude latitude, Longitude longitude)
 {
     this.Latitude  = latitude ?? throw new ArgumentNullException("latitude");
     this.Longitude = longitude ?? throw new ArgumentNullException("longitude");
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new GeoCoordinate
 /// </summary>
 /// <param name="latitude">The latitude in decimal degrees</param>
 /// <param name="longitude">The longitude in decimal degrees</param>
 public GeoCoordinate(double latitude, double longitude)
 {
     this.Latitude  = new Latitude(latitude);
     this.Longitude = new Longitude(longitude);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the distance between two coordinates using a rhumb line
 /// </summary>
 /// <param name="lat1">The source latitude</param>
 /// <param name="lon1">The source longitude</param>
 /// <param name="lat2">The destination latitude</param>
 /// <param name="lon2">The destination longitude</param>
 /// <param name="distanceType">The unit of measure for the distance, this defaults to KILOMETERS</param>
 /// <returns>The distance between the two coordinates</returns>
 public static double GetRhumbDistance(Latitude lat1, Longitude lon1, Latitude lat2, Longitude lon2, DistanceType distanceType)
 {
     return(GetRhumbDistance(new GeoCoordinate(lat1, lon1), new GeoCoordinate(lat2, lon2), distanceType));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the distance from this coordinate to another geocoordinate using a rhumb line
 /// </summary>
 /// <param name="latitude">The destination latitude</param>
 /// <param name="longitude">The destination longitude</param>
 /// <param name="distanceType">The distance type the results will be returned in, i.e. kilometers</param>
 /// <returns>The distance to the destination</returns>
 public double RhumbDistanceTo(Latitude latitude, Longitude longitude, DistanceType distanceType)
 {
     return(GetRhumbDistance(this, new GeoCoordinate(latitude, longitude), distanceType));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Gets the distance between two coordinates using the Haversine formula
 /// </summary>
 /// <param name="lat1">The source latitude</param>
 /// <param name="lon1">The source longitude</param>
 /// <param name="lat2">The destination latitude</param>
 /// <param name="lon2">The destination longitude</param>
 /// <param name="distanceType">The unit of measure for the distance, this defaults to KILOMETERS</param>
 /// <returns>The distance between the two coordinates</returns>
 public static double GetDistance(Latitude lat1, Longitude lon1, Latitude lat2, Longitude lon2)
 {
     return(GetDistance(new GeoCoordinate(lat1, lon1), new GeoCoordinate(lat2, lon2)));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Gets the bearing from one latitude/longitude coordinate to another based on the Rhumb formula
 /// </summary>
 /// <param name="lat1">The source latitude</param>
 /// <param name="lon1">The source longitude</param>
 /// <param name="lat2">The destination latitude</param>
 /// <param name="lon2">The destination longitude</param>
 /// <returns>The bearing from source to destination in degrees</returns>
 public static double GetRhumbBearing(Latitude lat1, Longitude lon1, Latitude lat2, Longitude lon2)
 {
     return(GetRhumbBearing(new GeoCoordinate(lat1, lon1), new GeoCoordinate(lat2, lon2)));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Gets the bearing in degrees to another geographic point from this
 /// geographic coordinate based on the Rhumb formula
 /// </summary>
 /// <param name="latitude">The destination latitude</param>
 /// <param name="longitude">The destination longitude</param>
 /// <returns>The bearing from source to destination in degrees</returns>
 public double RhumbBearingTo(Latitude latitude, Longitude longitude)
 {
     return(GetRhumbBearing(this, new GeoCoordinate(latitude, longitude)));
 }