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.Xpf.Map
Assembly: DevExpress.Xpf.Map.v24.2.dll
NuGet Package: DevExpress.Wpf.Map
Declaration
Remarks
Important
On May 21, 2024, Microsoft announced that Bing Maps for Enterprise and its API will be discontinued. Azure Maps will be a single unified enterprise mapping platform available from Microsoft.
We are working on API compatible with Azure Maps and expect to ship it with our next major release (v24.2).
If you have an existing license to Bing Maps for Enterprise, you can continue using our existing API. You need to transition to new API until June 30, 2025 (free and basic license) or until June 30, 2028 (enterprise license).
The last date you can get a new license to Bing Maps for Enterprise is June 30, 2025. If you do not have an existing license after that date, you would not be able to use our map controls with Bing Maps or Azure Maps (until we release the new API). During that time, you can use other map providers supported by our controls, such as OpenStreetMap.
Follow the steps below to calculate a route isochrone:
Create an InformationLayer object and add it to the MapControl.Layers collection.
Initialize the layer’s InformationLayer.DataProvider property with a BingRouteIsochroneDataProvider object.
Specify the provider’s BingKey property.
Call one of the following methods to calculate an isochrone:
Use the IsochroneOptions property to define parameters that are applied when the isochrone is calculated (for example, travel mode, distance measurement unit, and time measurement unit).
You can also handle the IsochroneCalculated event to customize the appearance of the polygon that the BingRouteIsochroneDataProvider generates.
The following code plots a polygon that shows an area accessible from the specified point:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:IsochroneMap"
xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
x:Class="IsochroneMap.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<dxm:MapControl x:Name="mapControl">
<dxm:ImageLayer>
<dxm:BingMapDataProvider BingKey="Insert your Bing key."
Kind="RoadLight" />
</dxm:ImageLayer>
<dxm:InformationLayer x:Name="infoLayer">
<dxm:BingRouteIsochroneDataProvider x:Name="isochroneProvider"
BingKey="Insert your Bing key."
GenerateLayerItems="False"
IsochroneCalculated="OnIsochroneCalculated">
<dxm:BingRouteIsochroneDataProvider.IsochroneOptions>
<dxm:BingRouteIsochroneOptions Mode="Driving"
DistanceUnit="Kilometer"/>
</dxm:BingRouteIsochroneDataProvider.IsochroneOptions>
</dxm:BingRouteIsochroneDataProvider>
</dxm:InformationLayer>
</dxm:MapControl>
</Grid>
</Window>
using DevExpress.Xpf.Map;
using System.Windows;
using System.Windows.Media;
namespace IsochroneMap {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
GeoPoint origin = new GeoPoint(42.3589935302734, -71.0586318969727);
isochroneProvider.CalculateIsochroneByDistance(new RouteWaypoint("Origin", origin), 10);
}
private void OnIsochroneCalculated(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.StrokeStyle = new StrokeStyle { Thickness = 4 };
item.Stroke = Brushes.Red;
MapPushpin pushpin = new MapPushpin { Location = e.CalculationResult.IsochroneResult.Origin, Brush = Brushes.Red };
VectorLayer vectorLayer = new VectorLayer();
mapControl.Layers.Add(vectorLayer);
MapItemStorage storage = new MapItemStorage();
vectorLayer.Data = storage;
storage.Items.Add(item);
storage.Items.Add(pushpin);
}
mapControl.ZoomToFitLayerItems();
}
}
}