The Microsoft Virtual Earth service support getting driving directions to specific locations. A route can consist of a maximum of 25 waypoints.
The method VE_GetDirections() takes a List<> of SearchLocations (it will throw an exception if more than 25 objects are in the List<>). As a result it returns a RouteDirections object that holds all information about the directions. The RouteDirections.RouteLegs property contains detailed information about each direction:

RouteDirections rd = ucVEarth.VE_GetDirections(
locations, // list of waypoints along the route
true, // display the route on the map
true, // center the map for best view
VEarth.ucVEarth.RouteModeEnum.Driving, // are we walking or driving?
VEarth.ucVEarth.DistanceUnitEnum.Kilometers); // show distance in miles or kilometers?
);
lstDirections.Items.Clear();
lstDirections.Items.Add(String.Format("Total distance: {0}", rd.TotalDistance));
lstDirections.Items.Add(String.Format("Total duration: {0}", rd.TotalDuration));
lstDirections.Items.Add("");
// Iterate through all route parts
foreach(RouteLeg rl in rd.RouteLegs)
{
lstDirections.Items.Add(String.Format("{0} - {1} - {2}", rl.Description, rl.Distance, rl.Duration));
}
The list of SearchLocation objects can contain both SearchLocation objects with set Latitude and Longitude properties and objects with the Where or What property set.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5