Reputation: 19
I'm working on a project and I need to display points of interest that are saved in a database.
For the itinerary, I used leaflet routing machine and nominatim.
Now I need to display those points of interest that are 5km around the route.
I found in this link https://www.liedman.net/leaflet-routing-machine/api/#iroute the property "coordinates". It returns an array of all the waypoints used to display the itinerary.
How can I use this function to make a call on my database each kilometer to get my informations ?
I hope I was clear and thank you !
Upvotes: 1
Views: 284
Reputation: 19
I found it ! I used this :
L.Routing.control({
waypoints: [(my waypoints)],
(my options)
}]}
}).on('routesfound', function(e){
console.log(e);}
The console.log(e) show all the coordinates we want to work on. And there is a yt video explaining that : https://www.youtube.com/watch?v=6mAdRdwZihc
For those who have the same problem
Upvotes: 0
Reputation: 332
I worked on a similar problem and in my case I queried the routing server directly and got the coordinates of each step between the waypoints.
Upvotes: 0