/winforms-map-calculate-routes-from-major-roads

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.

Primary LanguageVisual Basic .NETOtherNOASSERTION

Map for WinForms - Use the Bing Maps Route Web Service to Calculate Routes from Major Roads

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.

Resulting map

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.

Files to Look At

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)