Attribution information for data sources used by this layer.
Attributions are automatically displayed or hidden depending on whether the corresponding data is currently active or visible on the map — e.g., based on zoom level, layer visibility, or usage. This ensures that only active data providers are credited, as required by licensing.
Can be a simple string (displayed as static text), or an array of structured attribution entries that support clickable labels and optional tooltips.
Options to configure the remote elevation (DEM) data source.
This layer supports two types of elevation input:
Raster heightmaps are decoded into elevation values and triangulated into meshes at runtime. Mesh-based sources can directly deliver ready-to-render geometry per tile.
Attribution for the elevation data source.
Can be a string, a single DataSourceAttribution object, or an array of DataSourceAttribution objects. This is used to provide proper credit or licensing information for the elevation tiles.
Optional function to decode a single elevation value from pixel RGB(A).
Only applies to raster heightmap sources.
Required for custom raster encodings (if encoding
is not set).
Parameters:
r
, g
, b
, a
: individual color channels from a tile pixel
Returns:Optional decode function for custom mesh-based elevation tiles.
Required for custom mesh encodings (if encoding
is not set).
This function is expected to parse the raw binary or structured response data (e.g., ArrayBuffer, JSON) into a terrain mesh.
The responseType
must be explicitly set when using decodeMesh
to indicate the format of the incoming tile data.
The returned object must be of type TerrainMesh
:
{
vertices: Float32Array; // flat array of XYZ positions (x0, y0, z0, x1, y1, z1, ...)
indices: Uint16Array | Uint32Array; // triangle indices
normals?: Float32Array; // optional flat array of vertex normals
}
Maximum zoom level for elevation tile requests. Default is 20.
Minimum zoom level for which elevation tiles are available. Default is 1.
Constant offset to apply to decoded elevation values (in meters).
Used with scale
when no custom decodeHeight
or decodeMesh
is provided.
Optional response type hint for custom encodings.
Used to determine how the raw tile response is handled before decoding.
Required when using decodeMesh
to specify the format of the tile response (e.g. 'arraybuffer', 'json').
This setting allows the decoding pipeline to prepare the expected format from the fetch response.
Supported values:
Scale factor applied to decoded elevation values (in meters).
Used with offset
when no custom decodeHeight
or decodeMesh
is provided.
Tile URL template or resolver function for fetching elevation tiles.
The URL can be a string template (e.g. "https://example.com/tiles/{z}/{x}/{y}.png") or a function that dynamically generates the URL per tile.
For raster-based elevation data input, the URL points to an image (PNG/WEBP) tiles. For mesh input, the URL should return binary or structured mesh data (e.g. JSON, protobuf).
Optional imagery source to be used as a texture overlay on the terrain. This can enhance visual detail by projecting raster tiles (e.g., satellite imagery) over the elevation surface for a more realistic and visually rich 3D map.
Attribution for the imagery data source.
Can be a string, a single DataSourceAttribution object, or an array of such objects. This is used to provide proper credit or licensing information for the imagery tiles, similar to how TileLayerOptions.attribution works.
Tile URL template or a function returning the tile URL. If a string is provided, it can contain placeholders: {z}, {x}, {y}, or {quadkey}. If a function is provided, it receives the tile coordinates and should return the URL string.
Examples:
https://.../${quadkey}.jpg
This is typically used to fetch satellite imagery, orthophotos, or custom raster tiles.
tileMargin that should be applied to all providers of the layer.
maximum zoom level at which data from the TileLayer will be displayed.
Controls the mesh simplification accuracy when converting raster heightmaps to terrain meshes.
Specifies the maximum allowed geometric error (in meters) between the original heightmap and the generated mesh.
Can be:
This only applies when using raster elevation input.
minimum zoom level at which data from the TileLayer will be displayed.
Name of the TileLayer.
Whether to enable pointer interactions (e.g. hover/pick)
The data provider(s) for the TileLayer.
The provider can either be a single TileProvider or an array of {min: number, max: number, provider: TileProvider}, where "min" and "max" define the minimum and maximum zoom level at which data from the "provider" should be used. If a single provider is defined, it's data will be used for all zoom levels. If several providers are defined for a single zoom level, only the data of the first defined is used.
Optional style configuration for the terrain layer.
the size of the tile data in pixel.
Indicates whether the layer should be visible (true
) or hidden (false
).
Generated using TypeDoc
Configuration options for a TerrainTileLayer.
A TerrainTileLayer is capable of rendering elevation-based 3D terrain using different kinds of input data:
Raster heightmaps: Typically encoded grayscale images or DEM tiles. These are decoded and triangulated client-side into 3D meshes.
Pre-triangulated terrain meshes: Binary or JSON tile formats (e.g., quantized meshes) where the geometry is already prepared and only needs to be rendered.
The layer can optionally render an imagery overlay (such as satellite imagery) on top of the terrain surface.