Skip to content

ui/map/navdata/NavdataRenderer

Classes

Defined in: ui/map/navdata/NavdataRenderer.ts:26

NavdataRenderer - renders the static airports + waypoints overlay.

Unlike ShapeRenderer (which pushes simulation GeoJSON into geojson sources), this reads a pre-built vector-tile archive produced offline from the public-domain OurAirports data (see script/navdata/). The archive is served as a single static PMTiles file and exposes the source-layers "airports", "heliports", "waypoints" (radio navaids) and "runways" - plus "pavement" (aprons), "taxiways" and "buildings" (terminals/hangars) when the archive was built with an OpenStreetMap extract (those layers simply stay empty otherwise). Because the tiles load themselves, this renderer only has to declare the source + layers once and toggle their visibility.

If the archive is missing (the offline build step hasn't been run), MapLibre simply emits tile-load errors that MapDisplay already suppresses, so the rest of the map keeps working.

Constructors

Constructor
new NavdataRenderer(mapDisplay, stateManager): NavdataRenderer;

Defined in: ui/map/navdata/NavdataRenderer.ts:129

Parameters
mapDisplay

MapDisplay

stateManager

StateManager

Returns

NavdataRenderer

Methods

minAirportRankForZoom()
minAirportRankForZoom(zoom): number;

Defined in: ui/map/navdata/NavdataRenderer.ts:145

Lowest airport rank that is actually revealed at the given zoom, derived from AIRPORT_IMPORTANCE_BY_ZOOM (the same thresholds that drive the importance-opacity expression). Used by NavaidSnapper so snapping only targets airports the user can currently see.

Parameters
zoom

number

Returns

number

initialize()
initialize(): void;

Defined in: ui/map/navdata/NavdataRenderer.ts:171

Returns

void

prepareForStyleChange()
prepareForStyleChange(): void;

Defined in: ui/map/navdata/NavdataRenderer.ts:721

Explicit teardown for the basemap-attached aeroway layers (see tryAddBasemapAeroway), called right before a style swap starts.

MapLibre's own style diff removes layers whose source disappears, but only correctly if nothing re-attaches a layer to the dying source in between computing and executing that diff. The persistent 'sourcedata' listener registered in initialize() can do exactly that: on a slow or flaky connection (observed on the demo deployment, not locally), the basemap's vector-tile metadata can arrive - triggering tryAddBasemapAeroway - right as an offline-fallback swap (MapStyleManager.armFirstLoadFallback / handleMapError) is in flight, which surfaces as MapLibre's "Source ... cannot be removed while layer ... is using it" error. Removing the layers upfront and pausing tryAddBasemapAeroway (via styleTransitioning) until the new style has loaded closes that window.

Returns

void

onStyleChange()
onStyleChange(): void;

Defined in: ui/map/navdata/NavdataRenderer.ts:780

Re-add layers after a basemap style change wipes them (mirrors the pattern used by ShapeRenderer / MapOverlay).

Returns

void

destroy()
destroy(): void;

Defined in: ui/map/navdata/NavdataRenderer.ts:788

Returns

void