Rediger

Del via


GeoCoordinate.GetDistanceTo(GeoCoordinate) Method

Definition

Returns the distance between the latitude and longitude coordinates that are specified by this GeoCoordinate and another specified GeoCoordinate.

public:
 double GetDistanceTo(System::Device::Location::GeoCoordinate ^ other);
public double GetDistanceTo (System.Device.Location.GeoCoordinate other);
member this.GetDistanceTo : System.Device.Location.GeoCoordinate -> double
Public Function GetDistanceTo (other As GeoCoordinate) As Double

Parameters

other
GeoCoordinate

The GeoCoordinate for the location to calculate the distance to.

Returns

The distance between the two coordinates, in meters.

Remarks

The Haversine formula is used to calculate the distance. The Haversine formula accounts for the curvature of the earth, but assumes a spherical earth rather than an ellipsoid. For long distances, the Haversine formula introduces an error of less than 0.1 percent.

Altitude is not used to calculate the distance.

Applies to