Maps route directions from source to destination

2 posts / 0 new
Last post
sridatta
Maps route directions from source to destination

Dear Team

I am currently working on the project to show routes from origin to destination .my questions how to provide more than one route from origin to destination and the places to be identified from database or data set.Please help me out to resolve this query .

Thank you in advance.


MQBrianCoakley
In your directions callback

In your directions callback function, use the L.mapquest.directionsLayer to put the layer on the map. Only one L.mapquest.directionsLayer is on the map by default, but if you add it in your own function, you can skip the prior layer removal step. For example...

 

directions = L.mapquest.directions();

directions.route({

start: "Denver, CO",

end: "Golden, CO"

},

function(err, data) {

L.mapquest.directionsLayer({

directionsResponse: data,

}).addTo(map);

}

);

directions.route({

start: "Aurora, CO",

end: "Parker, CO"

},

function(err, data) {

L.mapquest.directionsLayer({

directionsResponse: data,

}).addTo(map);

}

);

 

 

Getting the data for the routes from a data store depends on several factors outside of the MapQuest sdk.