Skip to content

spatial-monorepo


spatial-monorepo / wayfinding/src / getDirectionsMultiDestination

Function: getDirectionsMultiDestination()

getDirectionsMultiDestination(graph, origin, destinations, opts?): DirectionsResult

Defined in: packages/wayfinding/src/directions.ts:459

Route from origin through all destinations in order, using a nearest- neighbour heuristic: from the current position, always visit the closest (by straight-line haversine distance) unvisited destination next.

origin accepts the same single/array/null current-location resolution as getDirections (issue #470) — an array is resolved once, up front, to whichever candidate is haversine-closest to the destination list, then used as the concrete starting node for the nearest-neighbour walk.

Returns a typed DirectionsResult (see getDirections) — the first leg that fails to resolve determines the overall failure reason.

Parameters

graph

WayfindingGraph

origin

string | string[] | null

destinations

string[]

opts?

DirectionOptions = {}

Returns

DirectionsResult

Released under commercial licensing.