Bing Maps v8 - How can I reload a saved route on a DirectionsManager, or equivalent?

285 views Asked by At

I mapped a route via DirectionsManager, and saved the route object. I would like to reload this route after a while. How to do?

Below, it follows an excerpt from the code where the route object is saved in a variable:

var directionsManager;

Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
    directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);

    directionsManager.setRequestOptions({ 
        routeMode: Microsoft.Maps.Directions.RouteMode.driving 
    });

    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated',onUpdateDirections);
});

var myRoute;

function onUpdateDirections(e) {
    myRoute = e.route;
};
1

There are 1 answers

0
rbrundritt On BEST ANSWER

The terms of use for Bing Maps do not allow storing the route data. The only data that can be stored is the geocode data, and this can only be stored for as long as you have a Bing Maps license.

If you want to reload a route that was displayed earlier, store the route end points and options used. If the route used real time traffic and you want to show the route based on , you can store the date and time as well and use that in your request.