Skip to main content
All docs
V23.2

BingRouteIsochroneDataProvider Class

Allows you to use the Bing Maps service to calculate an isochrone and display it on the map. An isochrone shows an area reachable from a specific location.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v23.2.dll

NuGet Package: DevExpress.Win.Map

Declaration

public class BingRouteIsochroneDataProvider :
    BingMapDataProviderBase

Remarks

Follow the steps below to calculate a route isochrone:

You can also handle the IsochroneCalculated event to customize the appearance of the polygon that the BingRouteIsochroneDataProvider generates.

Example

The following code plots a polygon that shows an area accessible from the specified point:

Isochrone map

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

    private void Form1_Load(object sender, EventArgs e) {
        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 Maps key.";
        GeoPoint origin = new GeoPoint(36.1532403246368, -86.7701703811725);
        mapControl1.CenterPoint = origin;
        isochroneDataProvider.CalculateIsochroneByDistance(new RouteWaypoint("", origin), 10);
        isochroneDataProvider.GenerateLayerItems = false;
        isochroneDataProvider.IsochroneCalculated += IsochroneCalculated;
        infoLayer.DataProvider = isochroneDataProvider;

    }

    private void IsochroneCalculated(object sender, BingRouteIsochroneCalculatedEventArgs e) {
        foreach (var polygon in e.CalculationResult.IsochroneResult.Polygons) {
            MapPolyline item = new MapPolyline();
            foreach (var points in polygon.Coordinates)
                item.Points.Add(points);
            item.StrokeWidth = 4;
            item.Stroke = Color.Red;

            VectorItemsLayer vectorLayer = new VectorItemsLayer();
            mapControl1.Layers.Add(vectorLayer);
            MapItemStorage storage = new MapItemStorage();
            vectorLayer.Data = storage;
            storage.Items.Add(item);
        }
        mapControl1.ZoomToFitLayerItems();
    }

Implements

See Also