perliedman / leaflet-routing-machine

Control for routing in Leaflet
https://www.liedman.net/leaflet-routing-machine/
Other
1.06k stars 347 forks source link

Is it possible to get the coordinates of the route without drawing anything on the map ? #670

Open MenasriaMohamed opened 1 year ago

MenasriaMohamed commented 1 year ago

Hi there, I want the route to be rendered and get the coordinates without drawing anything on the map ( without "AddtoMap") ,Is that possible??

curtisy1 commented 1 year ago

You should be able to call the route function on your control and then access the _routes property to get the routes.

Something like this should work

control.route();
const routes = control._routes;
const coordinates = control.getWaypoints();