0

How can I access the RoutePath Class when using the Bing Maps AJAX Control, Version 7.0?

I've loaded the directions module, calculated directions and called the getRouteResult method of the DirectionsManager Class. Unfortunately, it doesn't return the coordinates of the actual route.

Ultimately, I need the coordinates of the shape which makes up the route line.

1 Answer 1

1

Thanks to some help from Microsoft, I've found how RoutePath is exposed. Access RoutePath by:

DirectionsManagerObj.getRouteResult().routeLegs[routeLegIndex]
    .subLegs[subLegIndex].routePath;

This works great assuming you have two waypoints. Otherwise, you'll need to loop through routeLegs and subLegs to get the entire route.

A routeLeg represents the path through two waypoints. A subLeg represents the path through a stop point and via point (or two via points). The DirectionsManager Class API has more detail on this information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.