spatial-monorepo / wayfinding/src / getDirections
Function: getDirections()
getDirections(
graph,origin,destination,opts?):DirectionsResult
Defined in: packages/wayfinding/src/directions.ts:314
Compute a route between origin and destination using A*.
origin/destination each accept a single node id or an array of node ids — when either is an array, the closest resolvable pair by graph (A*) cost is used (Mappedin's "nearest washroom" pattern, issue #470).
origin also accepts null, resolved via the caller-supplied current-location chain (opts.currentLocationId → opts.youAreHereMarkerId — see DirectionOptions).
Returns a typed DirectionsResult instead of a bare route/null: { ok: true, route } on success, or { ok: false, reason } where reason is 'no-start' | 'no-end' | 'self' | 'no-route' (issue #470).
Parameters
graph
origin
string | string[] | null
destination
string | string[]
opts?
DirectionOptions = {}
