AzureRouteIsochroneDataProvider Class
Allows you to use the Azure Maps service to calculate an isochrone and display it on the map.
Namespace: DevExpress.Xpf.Map
Assembly: DevExpress.Xpf.Map.v25.1.dll
NuGet Package: DevExpress.Wpf.Map
Declaration
Remarks
The AzureRouteIsochroneDataProvider
implements the Azure Maps service. Assign such an object to the InformationLayer.DataProvider property to enable the service and display an isochrone (an area around an origin point). You can calculate the area based on travel time or distance.
Azure Maps services support JSON response formats. Install the System.Text.Json
package in projects that target .NET Framework to parse the Azure server response and display information on a DevExpress Map control.
Call one of the CalculateIsochroneByDistance method overloads to calculate an isochrone based on travel distance.
Call one of the CalculateIsochroneByTime method overloads to calculate an isochrone based on travel time.
When you call CalculateIsochroneByTime
or CalculateIsochroneByDistance
methods, use the options
(AzureRouteIsochroneOptions) parameter to specify route options.
The following settings are available:
- AzureRouteIsochroneOptions.AvoidTypes
- Excludes specified road or transportation types from the route.
- AzureRouteIsochroneOptions.ExtendedRouteDefinitions
- Specifies additional route calculation parameters (definitions).
- AzureRouteIsochroneOptions.TravelMode
- Specifies the transportation / commute mode.
The following example calculates and plots an isochrone. The code sets the origin point and travel distance limit (10 km).
<Window xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"...>
<Window.Resources>
<sys:String x:Key="azureKey">Your AzureMaps key here.</sys:String>
</Window.Resources>
<Grid>
<dxm:MapControl Loaded="MapControl_Loaded" Grid.Column="0"
x:Name="mapControl" ToolTipEnabled="True"
ShowSearchPanel="False" ZoomLevel="3">
<dxm:MapControl.ZoomTrackbarOptions>
<dxm:ZoomTrackbarOptions Visible="False" />
</dxm:MapControl.ZoomTrackbarOptions>
<dxm:ImageLayer>
<dxm:AzureMapDataProvider AzureKey="{StaticResource azureKey}" Tileset="BaseRoad"/>
</dxm:ImageLayer>
<dxm:InformationLayer x:Name="infoLayer">
<dxm:AzureRouteIsochroneDataProvider AzureKey="{StaticResource azureKey}"
x:Name="isochroneProvider"
LayerItemsGenerating="OnLayerItemsGenerating" />
</dxm:InformationLayer>
</dxm:MapControl>
</Grid>
</Window>
using DevExpress.Xpf.Map;
using System.Windows;
namespace WpfMapExample {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
private void MapControl_Loaded(object sender, RoutedEventArgs e) {
isochroneProvider.CalculateIsochroneByDistance(
new RouteWaypoint("", new GeoPoint(36.1532403246368, -86.7701703811725)),
maxDistanceMeters: 10000,
new AzureRouteIsochroneOptions { AvoidTypes = AzureRouteAvoidType.Motorways });
}
private void OnLayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs args) {
mapControl.ZoomToFit(args.Items);
}
}
}