Closed aneville closed 9 years ago
Hi!
Yeah, it would probably be good to expose a setVehicle
method to make this clear, but I think this will work fine as a workaround:
var routeControl = L.Routing.control({
router: new L.Routing.GraphHopper('myKey', {urlParameters: {vehicle: 'foot'}}),
geocoder: L.Control.Geocoder.nominatim()
}).addTo(map);
[...]
routeControl.options.vehicle = 'car';
Ugh of course I can store it as an object.... thanks! I think I just had some end of the day fuzziness going on. I was trying to figure out how to get a handle on it and I wasn't even assigning it to anything.
Hi,
I am currently trying to implement graphhopper on my leaflet map and I've had a lot of success so far. I'm currently trying to figure out how to modify router object settings after I've created an instance. I.e. I have a directions box that does walking directions like I want them to, but I would love to have more buttons that allow me to switch between walking, driving and cycling. I cannot figure out how to modify this urlParameters vehicle option that I created the object with:
L.Routing.control({ router: new L.Routing.GraphHopper('myKey', {urlParameters: {vehicle: 'foot'}}), geocoder: L.Control.Geocoder.nominatim() }).addTo(map);
What is the easiest way to change the vehicle parameter programmatically.
Thank you for your time,
Adam Neville