Skip to content

spatial-monorepo


spatial-monorepo / wayfinding/src / nearestWalkableNode

Function: nearestWalkableNode()

nearestWalkableNode(pt, graph, levelId?): WayfindingNode | undefined

Defined in: packages/wayfinding/src/graph.ts:569

Nearest graph node whose category is NOT a vertical transport type (stairs / elevator / escalator / ramp). Returns undefined for empty graphs.

levelId, when provided, restricts the search to nodes on that floor (node.levelId === levelId). Without it, behaviour is unchanged: nearest across all floors by horizontal haversine distance — which is only safe when the caller has no floor context for pt. In a multi-floor building, units stack vertically, so a point on one floor can be horizontally nearer a unit centroid on a different floor; a caller with a known floor (e.g. an RTLS/bluedot position) should always pass levelId (issue #584).

Parameters

pt

Position2D

graph

WayfindingGraph

levelId?

string

Returns

WayfindingNode | undefined

Released under commercial licensing.