For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Class DEMData

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.

Index

Constructors

  • Constructs a DEMData object

    Parameters

    • uid: string | number

      the tile's unique id

    • data: ImageData | RGBAImage

      RGBAImage data has uniform 2px padding on all sides: square tile edge size defines stride // and dim is calculated as stride - 4.

    • encoding: DEMEncoding

      the encoding type of the data

    • OptionalredFactor: number

      the red channel factor used to unpack the data, used for custom encoding only

    • OptionalgreenFactor: number

      the green channel factor used to unpack the data, used for custom encoding only

    • OptionalblueFactor: number

      the blue channel factor used to unpack the data, used for custom encoding only

    • OptionalbaseShift: number

      the base shift used to unpack the data, used for custom encoding only

    Returns DEMData

Properties

baseShift: number
blueFactor: number
data: Uint32Array
dim: number
greenFactor: number
max: number
min: number
redFactor: number
stride: number
uid: string | number

Methods

  • Parameters

    • borderTile: DEMData
    • dx: number
    • dy: number

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns number

  • Returns number[]

  • Parameters

    • v: number

    Returns { b: number; g: number; r: number }

  • Parameters

    • x: number
    • y: number

    Returns number

  • Parameters

    • r: number
    • g: number
    • b: number

    Returns number

Was this helpful?