Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to get routes to the destination point using the Bing Map Route data service

$
0
0

This example demonstrates how to calculate routes to the destination point from major roads using the BingRouteDataProvider.CalculateRoutesFromMajorRoads method.

Before route calculation, 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 using the BingRouteOptions.Mode property and route optimization options to calculate an optimal route either by time or by distance via the BingRouteOptions.RouteOptimization property.

To start the application, click the Calculate Routes From Major Roads button, which handles the calculateRoutes_Click event. All parameters are passed to the CalculateMajorRouteRequest method, and you can see the results in the rich text box element and calculated routes on a map.

The requested results contain the total distance of a route, route leg, itinerary item (BingRouteResult.Distance, BingRouteLeg.Distance, BingItineraryItem.Distance), the time required to follow the calculated route (BingRouteResult.Time) and pass the rout leg and itinerary item (BingRouteLeg.Time, BingItineraryItem.Time). You can also see the maneuver instructions associated with the itinerary item (BingItineraryItem.ManeuverInstruction) and other parameters.

Note that if you run this sample as is, you will get a warning message informing that the specified Bing Maps key is invalid. To learn how to register a Bing Maps account and create a key for it, refer to the How to: Get a Bing Maps Key tutorial.



Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>