mapbox-gl-directions
mapbox-gl-directions copied to clipboard
Ability to add multiple waypoints at once
It would be great if the plugin API could have a method like addWaypoints()
to complement the existing addWaypoint()
method. The reason for this is that displaying a route with multiple waypoints can result in rate limit issues as we are forced to do something like [simplified]:
this.directions
.setOrigin(origin)
.setDestination(destination);
waypoints.forEach((waypoint, index) => {
this.directions.addWaypoint(index, waypoint); // a request each time
});
which results in multiple fast requests. This should be possible as the underlying directions API allows adding multiple points to a single request. So I suppose what I am asking to be possible is something like:
this.directions
.setOrigin(origin)
.setDestination(destination)
.setWaypoints(waypoints);
Let me know if I have done something wrong or asked in the wrong place, and thanks for your time :)
Any updates on this?
Updates?
need updates....