TerrainSchema
constTerrainSchema:ZodObject<{exaggeration:ZodOptional<ZodNumber>;source:ZodString; },"strip",ZodTypeAny, {exaggeration?:number;source:string; }, {exaggeration?:number;source:string; }>
Defined in: packages/core/src/schemas/map.schema.ts:624
Map-level 3D terrain (U15, ml-chh.5) — the style spec’s root terrain.
Remarks
Section titled “Remarks”The authored shape IS the spec’s shape: source names a raster-dem
source (one declared in sources:, or one the basemap supplies) and
exaggeration scales its heights. Style half: live, the renderer calls
map.setTerrain once the source exists; on export it compiles verbatim to
the style.json root (class exports), and the document’s terrain wins
over one inherited from the basemap. maplibre-gl has carried terrain since
2.2.0, so the whole supported peer range renders it.
Give terrain its own raster-dem source rather than sharing the one a
hillshade layer reads — MapLibre’s own examples do this, because one
source serving both purposes renders at reduced quality.
Example
Section titled “Example”terrain: source: terrainSource exaggeration: 1.5