Distance(Coordinate, Coordinate, Shape) Constructor
Initializes a Distance object based on the distance between 2 coordinates.
Namespace: CoordinateSharpAssembly: CoordinateSharp (in CoordinateSharp.dll) Version: 3.1.1.1
XMLNS for XAML: Not mapped to an xmlns.
public Distance(
Coordinate coord1,
Coordinate coord2,
Shape shape
)
Parameters
- coord1 Coordinate
- Coordinate 1
- coord2 Coordinate
- Coordinate 2
- shape Shape
- Shape of earth
Distance formula may either be Haversine (Spherical Earth) or Vincenty (Ellipsoidal Earth) calculations.
The following example grabs the distance in KM and bearing between 2 coordinates
using Vincenty (ellipsoidal earth) calculations.
Coordinate coordinate1 = new Coordinate(25, 65);
Coordinate coordinate2 = new Coordinate(27.6, 63);
Distance distance = new Distance(coordinate1, coordinate2, Shape.Ellipsoid);
Console.WriteLine(distance.Kilometers); //350.50857212259
Console.WriteLine(distance.Bearing); //215.183316089463