Skip to content

spatial-monorepo


spatial-monorepo / wayfinding/src / Instruction

Interface: Instruction

Defined in: packages/wayfinding/src/types.ts:219

Properties

action?

optional action?: InstructionAction

Defined in: packages/wayfinding/src/types.ts:250

Structured turn classification (issue #484). Populated by the grid engine (findMultiFloorGridRoute), whose string-pulled path makes every vertex a genuine direction change — bearing-delta segmentation on that geometry is meaningful. The legacy centroid-graph engine's leg geometry is centroid → door-midpoint → centroid only, with no real turn data to segment, so its instructions omit this field (and the ones below), carrying only text/floorChange as before (unchanged, per DirectionOptions.engine's migration note).


bearingAfter?

optional bearingAfter?: number

Defined in: packages/wayfinding/src/types.ts:256

True-north bearing (degrees, 0-360) of the segment leaving coordinate. Absent for arrive.


bearingBefore?

optional bearingBefore?: number

Defined in: packages/wayfinding/src/types.ts:254

True-north bearing (degrees, 0-360) of the segment arriving at coordinate. Absent for depart.


coordinate?

optional coordinate?: Position2D

Defined in: packages/wayfinding/src/types.ts:258

Coordinate this instruction fires at — used by UI to focus/pan the map on step click.


distanceM?

optional distanceM?: number

Defined in: packages/wayfinding/src/types.ts:252

Metres to walk from this instruction's coordinate to the next instruction's (0 for arrive/connection steps).


floorChange?

optional floorChange?: object

Defined in: packages/wayfinding/src/types.ts:229

from

from: string

to

to: string

toLevelName?

optional toLevelName?: string

Real display name of the destination level (issue #484 AC2), resolved from the IMDF Level.properties.name label when available. Falls back to to (the raw level id) at render time when absent.

via

via: "stairs" | "elevator" | "escalator" | "ramp"


landmarkName?

optional landmarkName?: string

Defined in: packages/wayfinding/src/types.ts:271

Resolved display name of the nearest named IMDF unit/amenity within landmark range of this instruction's coordinate (issue #485 — turn-by- turn landmark enrichment, Wayfinding v2 plan §4 Phase 3 item 3), e.g. "Turn left at Cafeteria". Populated only on turn instructions (turn-left/turn-right/slight-left/slight-right) by enrichInstructionsWithLandmarks (landmarks.ts) — already resolved through IMDF label/locale resolution (resolveLabelDisplayName: prefers the en label, else the first available locale value), never a raw feature id. Absent when nothing named is within range (AC2) — UI must not synthesize placeholder text when this is undefined.


text

text: string

Defined in: packages/wayfinding/src/types.ts:228

Plain-English fallback description. Retained for the legacy 'graph' engine (directions.ts) and for any consumer that hasn't moved onto the structured action/distanceM/coordinate fields below. UI code should prefer action (routed through @diginestai/i18n) when present and only fall back to displaying text verbatim when it is absent — text is never localized.

Released under commercial licensing.