How to add intermediate waypoints (via)
Closed this issue · 3 comments
Does the API support intermediate waypoints as shown in the demo ?. How to achieve ?. Imported the (leaflet-headless) and (leaflet-routing-machine) modules , done something but in vain.
Any help is appreciated. Thanks in advance :)
Hi,
the API in itself only allows two waypoints. Via points is trivial, though, since you can just do multiple route queries; for example, for a route A->B->C, first query the route A->B, then query the route B->C, and concatenate the results.
The code for the demo is available in the gh-pages
branch. You can see more exactly how it interacts with Leaflet Routing Machine, by adding a customer router class, here: https://github.com/perliedman/geojson-path-finder/blob/gh-pages/router.js
Nice. saves time. Can we find an alternative route (i.e , second shortest route) ?.