perliedman / leaflet-routing-machine

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

Route with Ordered List of Waypoints #464

Closed cexposit closed 6 years ago

cexposit commented 6 years ago

Hi, I have noticed that given an array of waypoints the obtained route does not respect the order of waypoints provided in the array (in some cases). This means the i-th waypoint in the array is not always immediately before (i+1)-th.

In the following I include a snippet:

L.Routing.control({
        waypoints: myWaypoints,
        draggableWaypoints: false,
        routeWhileDragging: false,
        lineOptions: {
          addWaypoints: false
        }
}).addTo(map)

Is it possible to guarantee the order of the waypoints provided?

Thank you in advance :)

perliedman commented 6 years ago

Hi, that sounds very odd. The order of the waypoints should never be altered by Leaflet Routing Machine or the routing backend. Can you provide an example of waypoints where this happens?