perliedman / leaflet-routing-machine

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

Show POI near routing #681

Open refda opened 1 year ago

refda commented 1 year ago

Hello, I have a mysql database with a lot of points (lat/lon) and would like to display all points near the route. For example all supermarkets around the driving route. How can I get line coordinates from this route and send them to the database? I only worked with fixed points and radius to query mysql data. Would be glad to hear some tips.

curtisy1 commented 1 year ago

How can I get line coordinates from this route and send them to the database?

If you have your routing machine set up correctly, you could access control._routes to get access to the routes returned from your routing provider. The _routes object has a coordinates property, which is an array of leaflet LatLngs.

refda commented 1 year ago

How can I get line coordinates from this route and send them to the database?

If you have your routing machine set up correctly, you could access control._routes to get access to the routes returned from your routing provider. The _routes object has a coordinates property, which is an array of leaflet LatLngs.

Thanks for the suggestions. I will try to follow these properties. For now I am trying to to convert LatLngs to Points in the database to make proper requests.