Distance(Coordinate, Coordinate, Shape) Constructor

Initializes a Distance object based on the distance between 2 coordinates.

Definition

Namespace: CoordinateSharp
Assembly: CoordinateSharp (in CoordinateSharp.dll) Version: 3.1.1.1
XMLNS for XAML: Not mapped to an xmlns.
C#
public Distance(
	Coordinate coord1,
	Coordinate coord2,
	Shape shape
)

Parameters

coord1  Coordinate
Coordinate 1
coord2  Coordinate
Coordinate 2
shape  Shape
Shape of earth

Remarks

Distance formula may either be Haversine (Spherical Earth) or Vincenty (Ellipsoidal Earth) calculations.

Example

The following example grabs the distance in KM and bearing between 2 coordinates using Vincenty (ellipsoidal earth) calculations.
C#
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

See Also