Skip to content

spatial-monorepo


spatial-monorepo / ui/src / useWayfinding

Function: useWayfinding()

useWayfinding(graph, obstacles?, activeFloorId?): UseWayfindingResult

Defined in: packages/ui/src/useWayfinding.ts:166

useWayfinding(graph, obstacles?, activeFloorId?) — pure routing logic with no map dependency.

Returns { setStart, setStop, path, startCoord, stopCoord, reset }. path is a GeoJSON LineString Feature or null. Obstacles are pre-processed at hook initialisation time (not per route call).

activeFloorId (issue #460), when provided, restricts setStart/setStop snapping to nodes on that floor (and vertical-transport nodes are always excluded regardless) — otherwise a tap can silently snap onto a different floor's node that happens to be geometrically closer.

Parameters

graph

WayfindingGraph

obstacles?

ObstaclePolygon[] = NO_OBSTACLES

activeFloorId?

string

Returns

UseWayfindingResult

Released under commercial licensing.