Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 4.15 KB

File metadata and controls

19 lines (12 loc) · 4.15 KB

Map for WPF - How to Get Routes to the Destination Point with the Bing Map Route Data Service

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

Before route calculation, specify destination point coordinates (GeoPoint.Latitude and GeoPoint.Longitude). In addition, you can specify the optional parameters: the destination name (RouteWaypoint.Description), driving or walking route travel mode using the BingRouteOptions.Mode property and route optimization options to calculate the optimal route either by time or by distance with the BingRouteOptions.RouteOptimization property.

To start the application, click the Calculate Routes From major Roads button , it handles the calculateRoutes_Click event. All parameters are passed to the CalculateMajorRoutes method, and you can see the results in the textblock element below 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 more how to register a Bing Maps account and create a key for it, please refer to the How to: Get a Bing Maps Key tutorial.


Files to Review

Documentation