Elevation tiles and hillshade
Elevation tiles and hillshade (07.12 / 08.15a)
Common raster-dem sources now decode lossless PNGs using mapbox (default), terrarium or custom. Heights in meters are -10000 + (R65536+G256+B)0.1 for mapbox, and R256+G+B/256-32768 for terrarium. Custom uses RredFactor+GgreenFactor+B*blueFactor+baseShift; channel factors default to 1 and baseShift to 0. Custom fields are rejected for other encodings. Factors and decoded heights have an absolute limit of 1e8. Transparent pixels are nodata, not zero-height terrain. JPEG is rejected.
map.addSource('dem',{
type:'raster-dem',tiles:['https://your-provider/{z}/{x}/{y}.png'],
tileSize:512,encoding:'terrarium',attribution:'Data provider credit'
});
map.addLayer({id:'shade',type:'hillshade',source:'dem',paint:{
'hillshade-method':'basic',
'hillshade-illumination-anchor':'map',
'hillshade-illumination-direction':335,
'hillshade-illumination-altitude':45,
'hillshade-exaggeration':0.5
}});
await map.sqs.flush({render:true});
08.15c adds standard/viewport defaults and five single-light algorithms. Omitted paint now runs; multiple-light arrays still reject. Supported inputs: one direction 0..359 degrees, altitude 0..90, intensity 0..1 and shadow/highlight/accent colors. Numbers/colors use common zoom expressions; feature properties, state and filters are unavailable. Zero degrees means north; 90 means east. Our implementation mixes shadow/highlight using metric slopes and cosine illumination, then applies an accent with 25% slope weight. Intensity controls final alpha. Pixel equivalence with other engines is not promised.
Native and WASM share decoding and cached derived pixels, public layer ordering, visibility, zoom range and revisions. Paint changes update the GPU texture revision. PNG responses are limited to 4 MiB and decoded sides to 1024 pixels. Original RGBA plus f32 heights count toward the map-wide 64 MiB tile cache; derived RGBA counts toward the 128 MiB layer budget. Registration alone downloads nothing; use actual source events/tileState for readiness.
TileJSON, setTiles/setUrl, bounds, zoom limits, credits and common volatile policy are supported. getSource returns a raster-dem handle; source.sqs.getTileMetadata().encoding identifies the decoder. Source tileState includes height memory. Pixel layers have no queryable vector features or feature-state. Supply a real provider URL and display its required credits.
Tile borders currently use one-sided differences. Neighbor stitching, multiple-light arrays, 3D terrain meshes, draping/elevation queries, globe and mobile device acceptance remain pending. Hillshade colors a flat map surface; it does not implement setTerrain.
Names follow the MapLibre source specification and hillshade specification. SqsMap implements its own shared decoder and rendering.
Elevation coloring is now available using the same DEM cache.