This example demonstrates how to receive route information from the Bing Maps route service to calculate routes to the destination point from major roads, and how to display information about the resulting routes.
NOTE: You are required to specify the Bing Maps key to use Bing Maps services. Refer to the following tutorial for more information: How to: Get a Bing Maps Key.
The main steps required to create such an application are described below.
Create a BingRouteDataProvider
object and assign it to the InformationLayer.DataProvider property.
Specify destination point coordinates (GeoPoint.Latitude
and GeoPoint.Longitude
). In addition, you can specify optional parameters (the destination name, driving or walking route travel mode, and route optimization options) to calculate the optimal route by time or by distance. To do this, set the BingRouteOptions.Mode
and BingRouteOptions.RouteOptimization
properties.
To calculate a route, click the Calculate Routes From Major Roads button. All parameters are passed to the BingRouteDataProvider.CalculateRoutesFromMajorRoads
method. After that, the map will display the calculated route, and the rich text box element will contain the route information. You can access the route information in the BingRouteDataProvider.RouteCalculated
event arguments.
The provider generates map items to display the route and waypoints since its GenerateLayerItems
property is enabled. You can handle the InformationDataProviderBase.LayerItemsGenerating
event to customize the item appearance.
- How to zoom a map to a calculated route using the RouteCalculated event
- How to Implement a Custom Route Provider
- How to implement a route calculator using GIS providers
- How to calculate a route between waypoints and customize the appearance of a route path using a Microsoft Bing Maps Route web service
- How to calculate a route between two addresses
- How to manually generate map items for location information received from the Bing Search provider
- How to get additional search results using the Bing Map Search service
(you will be redirected to DevExpress.com to submit your response)