Back to Devexpress

GeoUtils.CalculateDistance(GeoPoint, GeoPoint) Method

wpf-devexpress-dot-xpf-dot-map-dot-geoutils-dot-calculatedistance-x28-devexpress-dot-xpf-dot-map-dot-geopoint-devexpress-dot-xpf-dot-map-dot-geopoint-x29.md

latest2.0 KB
Original Source

GeoUtils.CalculateDistance(GeoPoint, GeoPoint) Method

Calculates the distance between specified points.

Namespace : DevExpress.Xpf.Map

Assembly : DevExpress.Xpf.Map.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public static double CalculateDistance(
    GeoPoint p1,
    GeoPoint p2
)
vb
Public Shared Function CalculateDistance(
    p1 As GeoPoint,
    p2 As GeoPoint
) As Double

Parameters

NameTypeDescription
p1GeoPoint

The first geographical point.

| | p2 | GeoPoint |

The second geographical point.

|

Returns

TypeDescription
Double

The distance in meters.

|

Remarks

This CalculateDistanceoverload considers the Earth to be a reference ellipsoid (WGS 84) and calculates distance along an ellipsoidal surface.

The following example shows how to use the CalculateDistance method to compute the distance between two points:

csharp
double distance = GeoUtils.CalculateDistance(new GeoPoint(36.1, -115.1), new GeoPoint(34, -118.2));
vb
Dim distance As Double = GeoUtils.CalculateDistance(New GeoPoint(36.1, -115.1), New GeoPoint(34, -118.2))

See Also

GeoUtils Class

GeoUtils Members

DevExpress.Xpf.Map Namespace