Skip to content

spatial-monorepo


spatial-monorepo / wayfinding/src / inferUnitForOpening

Function: inferUnitForOpening()

inferUnitForOpening(opening, units): string | undefined

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

Infer which unit an Opening belongs to by checking whether the opening's geometry centroid falls inside (or within 0.1 m of) a unit polygon.

Returns the id of the matching unit, or undefined if none found. When the centroid straddles two boundaries, returns the closest unit centroid.

Parameters

opening

IMDFFeature`<OpeningProps>`

An IMDF Opening feature (any geometry type).

units

IMDFFeature`<UnitProps>`[]

Candidate Unit features to test against.

Returns

string | undefined

Released under commercial licensing.