The existing calculated route Feature with LineString geometry
Array of existing waypoints in order (origin, intermediate waypoints, destination)
The waypoints whose insertion slots to compute
An array of insertion slot indices, one per new waypoint, in input order
newWaypoints returns an empty array.0 for every
new waypoint — i.e. they would all prepend.0,
matching the singular findBestWaypointInsertionIndex behavior.
Multi-waypoint variant of findBestWaypointInsertionIndex.
Projects every existing and new waypoint onto the route exactly once, then returns one insertion slot per new waypoint. The i-th returned index is the slot in
existingWaypoints(0 = before origin,existingWaypoints.length= after destination) where the i-th new waypoint falls based on its along-route location.Multiple new waypoints may share the same slot. Use withInsertedWaypoints when you also need them merged into the existing array in correct along-route order — that helper handles within-slot ranking on top of these slot indices.