Back to Devexpress

GeoUtils.CalculateDistance(GeoPoint, GeoPoint, Boolean) 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-system-dot-boolean-x29.md

latest2.5 KB
Original Source

GeoUtils.CalculateDistance(GeoPoint, GeoPoint, Boolean) Method

Determines the distance between two geographical points in meters. Allows you to specify whether to use the ellipsoidal-surface formula for the calculation of distance.

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,
    bool ignoreEllipsoidalEffects
)
vb
Public Shared Function CalculateDistance(
    p1 As GeoPoint,
    p2 As GeoPoint,
    ignoreEllipsoidalEffects As Boolean
) As Double

Parameters

NameTypeDescription
p1GeoPoint

The first geographical point.

| | p2 | GeoPoint |

The second geographical point.

| | ignoreEllipsoidalEffects | Boolean |

true if ellipsoidal effects are ignored; otherwise, false.

|

Returns

TypeDescription
Double

The distance in meters.

|

Remarks

The following code computes the distance between two points:

csharp
using DevExpress.Xpf.Map;

private void OnButtonClick(object sender, RoutedEventArgs e) {
    double distance = GeoUtils.CalculateDistance(new GeoPoint(-5.93107, -35.112723), new GeoPoint(4.253438, 5.47072), true);
}
vb
Imports DevExpress.Xpf.Map

Private Sub OnButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim distance As Double = GeoUtils.CalculateDistance(New GeoPoint(-5.93107, -35.112723), New GeoPoint(4.253438, 5.47072), True)
End Sub

See Also

GeoUtils Class

GeoUtils Members

DevExpress.Xpf.Map Namespace