The MapLibre map to attach terrain to.
The injected maplibregl namespace + tuning; see
CreateEsriTerrainOptions. Datasets are added afterward with
EsriTerrainController.addLayer.
A controller to push/reorder/remove layers and tear the stack down; see EsriTerrainController.
import * as maplibregl from 'maplibre-gl';
import { prepareMapLibre, createEsriTerrain } from '@bitruvius/sdk-maplibre';
await prepareMapLibre(maplibregl); // v6: wires the worker module · v5: no-op
const map = new maplibregl.Map({ container: 'map', style, pitch: 60 });
const terrain = await createEsriTerrain(map, { maplibregl, exaggeration: 1.5 });
await terrain.addLayer({ url: '…/WorldElevation3D/Terrain3D/ImageServer' }); // base
const ky = await terrain.addLayer({ url: '…/Ky_DEM_KYAPED_Phase2_WM/ImageServer' }); // overrides over Kentucky
// ky.remove(); // revert the Kentucky region to the global base
Esri-style layered terrain: manage an ordered stack of Esri elevation datasets behind ONE virtual
raster-demsource. Per terrain tile the topmost layer with valid data at a pixel wins, falling through to the layers beneath where it has no coverage — exactly like Esri'sGround.layers.