Skip to main content
All docs
V24.1

BingRouteIsochroneOptions.DistanceUnit Property

Gets or sets the distance measurement unit for which an isochrone is calculated.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.1.dll

NuGet Package: DevExpress.Win.Map

Declaration

[DefaultValue(DistanceMeasureUnit.Kilometer)]
public DistanceMeasureUnit DistanceUnit { get; set; }

Property Value

Type Default Description
DistanceMeasureUnit Kilometer

The distance measurement unit.

Available values:

Name Description
Kilometer

All distances are measured in kilometers.

Mile

All distances are measured in miles.

Property Paths

You can access this nested property as listed below:

Object Type Path to DistanceUnit
BingRouteIsochroneDataProvider
.IsochroneOptions .DistanceUnit

Remarks

Specify the DistanceUnit property to set the measurement unit for the distance that you pass to the CalculateIsochroneByDistance method parameters.

Example

The following code plots a polygon that shows the area that is accessible from the specified point. The size of the area depends on a given travel distance (the distance is equal to 10 miles in the example below):

Distance-based isochrone

using DevExpress.XtraMap;
using System;
using System.Windows.Forms;

namespace IsochroneSample {
    public partial class Form1 : Form {

        private void Form1_Load(object sender, EventArgs e) {
            // Create a background image layer.
            ImageLayer imageLayer = new ImageLayer();
            mapControl1.Layers.Add(imageLayer);
            BingMapDataProvider provider = new BingMapDataProvider();
            provider.BingKey = "Insert your Bing key.";
            provider.Kind = BingMapKind.RoadLight;
            imageLayer.DataProvider = provider;

            InformationLayer infoLayer = new InformationLayer();
            mapControl1.Layers.Add(infoLayer);

            BingRouteIsochroneDataProvider isochroneDataProvider = new BingRouteIsochroneDataProvider();
            isochroneDataProvider.BingKey = "Insert your Bing key.";
            GeoPoint origin = new GeoPoint(36.1532403246368, -86.7701703811725);
            mapControl1.CenterPoint = origin;
            isochroneDataProvider.IsochroneOptions.DistanceUnit = DistanceMeasureUnit.Mile;
            isochroneDataProvider.IsochroneOptions.Mode = BingTravelMode.Driving;
            isochroneDataProvider.CalculateIsochroneByDistance(new RouteWaypoint("", origin), 10);
            infoLayer.DataProvider = isochroneDataProvider;

            infoLayer.DataRequestCompleted += OnDataRequestCompleted;
        }

        private void OnDataRequestCompleted(object sender, RequestCompletedEventArgs e) {
            // Call the ZoomToFitLayerItems method to zoom the map so that it displays the created isochrone.
            mapControl1.ZoomToFitLayerItems();
        }
    }
}
See Also