@teluala/terrain
v0.1.0-beta.3
Published
Shared elevation sources and sampling for Teluala.
Downloads
110
Readme
@teluala/terrain
Elevation sources and shared height sampling for the Teluala WebGPU globe.
@teluala/terrain is an optional package for the core teluala package (a peer
dependency). It turns raster DEM tiles into a ground surface. Pass the surface to
globe.setGroundSurface(); layers such as @teluala/raster can sample the same
heights.
Install
Install this package together with the core:
npm install teluala@beta @teluala/terrain@betaUsage
import { GlobeEngine } from 'teluala';
import { createTerrainSurface, createWorkerXyzDemTileSource } from '@teluala/terrain';
const globe = await GlobeEngine.create(document.querySelector('canvas'));
const ground = createTerrainSurface({
source: createWorkerXyzDemTileSource({
url: 'https://dem.example.com/{z}/{x}/{y}.png',
encoding: 'terrarium', // or 'terrainrgb'
}),
minZoom: 2,
maxZoom: 10,
attribution: ['Elevation © your DEM provider'],
});
globe.setGroundSurface(ground);Encodings
'terrarium': the Terrarium PNG format, as served by AWS Terrain Tiles (elevation-tiles-prodon the Registry of Open Data on AWS).'terrainrgb': the Terrain-RGB format used by Mapbox Terrain-RGB and MapTiler Terrain RGB.
Each dataset has its own terms of use and attribution requirements; follow
those of your provider. For another format, implement HeightTileSource
(getHeightTile() resolving to a HeightTile) and pass it as source.
License
MIT
