perliedman/leaflet-routing-machine

Show POI near routing

refda opened this issue · 2 comments

refda commented

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.

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

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.