none
Plot route on map layer using direction manager RRS feed

  • Question

  • Hi,

    We have created one sample application where we want to plot route on map layer rather directly plotting route on map. We have created direction manager as below :

     var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);

    We added waypoints to direction manager. However directionsManager.calculateDirections() plots the route on Map. Here we want to plot route on layer and then insert that layer on Map. Is it possible?

    Also, Is there any way to get zoom level of plotted route from direction manager?

    Thanks in advance!

     

    Thursday, January 11, 2018 6:45 AM

Answers

  • To do this you would need to use the directionsUpdated event. When it is fired, you can get the calculated route information from the direction manager and then use that to create a polyline for the route and pushpins for waypoints as needed, then add these to a custom layer. You will want to use the render options to disable rendering of the default rendering.

    Note, that by doing this you will end up losing the ability to drag the route to update it.


    [Blog] [twitter] [LinkedIn]

    Friday, January 12, 2018 6:14 AM