Skip to content

DEMData

Defined in: src/data/dem_data.ts:22

DEMData is a data structure for decoding, backfilling, and storing elevation data for processing in the hillshade shaders data can be populated either from a png raw image tile or from serialized data sent back from a worker. When data is initially loaded from a image tile, we decode the pixel values using the appropriate decoding formula, but we store the elevation data as an Int32 value. we add 65536 (2^16) to eliminate negative values and enable the use of integer overflow when creating the texture used in the hillshadePrepare step.

DEMData also handles the backfilling of data from a tile's neighboring tiles. This is necessary because we use a pixel's 8 surrounding pixel values to compute the slope at that pixel, and we cannot accurately calculate the slope at pixels on a tile's edge without backfilling from neighboring tiles.

Constructors

Constructor

new DEMData(uid: string | number, data: ImageData | RGBAImage, encoding: DEMEncoding, redFactor: number, greenFactor: number, blueFactor: number, baseShift: number): DEMData

Defined in: src/data/dem_data.ts:45

Constructs a DEMData object

Parameters

ParameterTypeDefault valueDescription
uidstring | numberundefinedthe tile's unique id
dataImageData | RGBAImageundefinedRGBAImage data has uniform 1px padding on all sides: square tile edge size defines stride // and dim is calculated as stride - 2.
encodingDEMEncodingundefinedthe encoding type of the data
redFactornumber1.0the red channel factor used to unpack the data, used for custom encoding only
greenFactornumber1.0the green channel factor used to unpack the data, used for custom encoding only
blueFactornumber1.0the blue channel factor used to unpack the data, used for custom encoding only
baseShiftnumber0.0the base shift used to unpack the data, used for custom encoding only

Returns

DEMData