spatial-monorepo / wayfinding/src / buildGraph
Function: buildGraph()
buildGraph(
archive,opts?):WayfindingGraph
Defined in: packages/wayfinding/src/graph.ts:296
Derive a WayfindingGraph from an IMDFArchive.
Same-floor edges: one bidirectional edge per Opening (LineString geometry). The two units connected by an opening are inferred geometrically: each LineString endpoint is tested against all unit polygons on the same floor using point-in-polygon (ray-casting). Openings whose endpoints resolve to the same unit or to no unit are silently skipped. The legacy unit_ids extension property is no longer read.
Cross-floor edges: vertical unit pairs (category in stairs/elevator/escalator/ramp) on adjacent floors whose Anchor display_point coordinates are ≤5 m apart. Per PRD F12, Anchor display_point is preferred; falls back to unit display_point when no Anchor references the unit. Only same-category pairs are matched (stairs↔stairs, elevator↔elevator, etc.) — a cross-type match would indicate a data modelling error. Cost: elevator = 30 s, stairs/escalator = floor_height_m / 1.2, ramp = floor_height_m / 0.8.
Parameters
archive
opts?
floorHeightM?
number
