[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Collapse]Map Control
   [Expand]Getting Started
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Collapse]GIS Data
     Search
     Geocode
     Routing
     Elevation
   [Expand]Vector Data
   [Expand]Visual Elements
   [Expand]End-User Interaction
   [Expand]Examples
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Routing

The Map control supports Microsoft's Bing Route service. This service provides the most optimal route, either from major roads in four directions, or calculated between two or more locations on a map.

The Bing Route data provider provides the Map control's routing functionality and is represented by the BingRouteDataProvider object. The sections below explain how to use the BingRouteDataProvider in the map control.

Important

Due to Bing canceling the SOAP service on July 30, 2017, the Map Control's Bing Route provider does not work correctly in version 16.1 or earlier.

Expanded Enable Routing

Do the following to enable routing in the Map control:

The code snippet below shows how to do this.

There are two ways to use the map routing feature in your application, depending on your task:

  • Calculate a route between two or more locations on a map;
  • Get a route from major roads to the specified destination.

The sections below describe each approach.

Expanded Calculate a Route between Locations

When the Map control is connected to the Bing Route service (see the section above for details), you can calculate a route between two or more locations on a map. To accomplish this, call the BingRouteDataProvider.CalculateRoute method and pass the list of locations (waypoints) as its argument, as shown below.

The image below shows the calculated route between the specified locations on the map.

Expanded Calculate Routes from Major Roads

The Map control allows you to obtain different routes to a specified location (latitude and longitude coordinates) using major roads from the north, east, south, and west. If it cannot find major roads coming from these directions, the response may contain more than one route from the same direction or fewer than four routes.

For instance, an application UI contains two combo boxes named "cbMode" and "cbOptimize", two text boxes named "tbLatitude" and "tbLongitude", and a button named "calculateRoutes".

To start a route calculation, click the Calculate Routes button. This calls the BingRouteDataProvider.CalculateRoutesFromMajorRoads method and a destination location (waypoint coordinates and description) and options are passed to its argument.

The results for San Francisco (Latitude - "37.783333" and Longitude - "-122.416667") are shown in the image below.

Expanded Routing Result

The RouteCalculationResult object that is provided by the BingRouteDataProvider.RouteCalculated event handler arguments' BingRouteCalculatedEventArgs.CalculationResult stores the route calculation results from the Bing Route service.

For instance, you can access a route path between locations calculated in the Calculate a Route between Locations section of this document.

To accomplish this, handle the BingRouteDataProvider.RouteCalculated event.

The result is shown in the image below.

Expanded See Also

Is this topic helpful?​​​​​​​