Closed vespino closed 4 years ago
hi, can you share your code ? to how did you try to do it.
I'm using this code to insert a fixed route:
L.Routing.control({
router: L.routing.mapbox('api-key'),
waypoints: [
L.latLng('some lat', 'some lng'),
L.latLng('some lat', 'some lng')
],
routeWhileDragging: true
}).addTo(map);
I was hoping to add this dynamically with variable waypoint.
Yes, it is possible. Just just initialize the waypoints
array with your coordinates, or use the setWaypoints
method.
@perliedman would you mind sharing an example?
I have been able to add the plugin to my project, but I was hoping to make dynamic routes instead of fixed ones. I have a number of markers which of course have lat/lng and when clicked on a link, I had hoped to fire up the plugin and add the route. Is this possible?