Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GeoUtils.CalculateStrokeLength(MapShape) Method

Returns the map shape’s stroke length in meters.

Namespace: DevExpress.Xpf.Map

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

NuGet Package: DevExpress.Wpf.Map

#Declaration

public static double CalculateStrokeLength(
    MapShape shape
)

#Parameters

Name Type Description
shape MapShape

The map shape whose stroke length should be calculated.

#Returns

Type Description
Double

The map shape stroke length in meters.

#Remarks

You can use the CalculateStrokeLength method to determine the stroke length of the following vector items:

The following code computes a selected map item’s stroke length when the MapControl.SelectionChanged event occurs:

private void MapControl_SelectionChanged(object sender, MapItemSelectionChangedEventArgs e) {
    MapShape mapShape = vectorLayer.SelectedItems[0] as MapShape;
    double strokeLength = GeoUtils.CalculateStrokeLength(mapShape);
    label.Content = $"StokeLength: {strokeLength / 1000:F2} km";
}
See Also