Skip to content

RasterDemSource

Namespace: ThinkGeo.Core

An elevation tile source built in code - the object form of a style document's raster-dem declaration, for terrain without a document to declare it in. Hand it to MapStyle.SetTerrain(RasterDemSource, double).

public sealed class RasterDemSource

Inheritance object → RasterDemSource

Constructors

RasterDemSource(string, DemEncoding, int, int, int)

public RasterDemSource(string tileUriTemplate, DemEncoding encoding, int tileSize, int minZoom, int maxZoom)

Parameters

tileUriTemplate string
The elevation tiles' XYZ URL template, with {z}, {x} and {y} placeholders.

encoding DemEncoding
How the tiles' RGB decodes to metres - the server's to say: Mapbox Terrain-RGB and Terrarium tiles look alike and decode to very different heights.

tileSize int
Edge length in pixels of the published tiles.

minZoom int
Shallowest zoom tiles are published at.

maxZoom int
Deepest zoom tiles are published at; display beyond it samples ancestor tiles.

RasterDemSource(RasterTileSource, DemEncoding, Nullable<int>, Nullable<int>)

The same declaration over a tile source built in code - elevation tiles cut from a local file rather than fetched from a server. Everything downstream is identical: terrain, hillshade and the elevation queries read this source the way they read a URL template's tiles.

public RasterDemSource(RasterTileSource source, DemEncoding encoding, Nullable<int> minZoom, Nullable<int> maxZoom)

Parameters

source RasterTileSource
Where the elevation tiles come from - for a local DEM file, an over the GDAL extension's GdalElevationSource.

encoding DemEncoding
How the tiles' RGB decodes to metres - the encoding the source writes. An says its own in .

minZoom Nullable<int>
Shallowest zoom tiles are cut at. Null, the default, takes the source's .

maxZoom Nullable<int>
Deepest zoom tiles are cut at; display beyond it samples ancestor tiles. Null, the default, takes the source's - the level where the data's own resolution runs out, so a coarse DEM is not asked for levels it cannot fill and a fine one is not cut short.

Exceptions

ArgumentException
The source is an and is not the one it writes.

Remarks:

The source's range is read when the DEM is added to a style (MapStyle.SetTerrain(RasterDemSource, double), AddHillshade). An ElevationRasterTileSource knows its range once built; a source that reads it from its data at open - an MBTiles or PMTiles archive - should be opened first.