Skip to main content

Module mapbox

Module mapbox 

Source
Expand description

Mapbox “Terrain-RGB” elevation tile encoding.

Formula: elevation = -10000 + (R * 65536 + G * 256 + B) * 0.1 (metres).

Reference: https://docs.mapbox.com/data/tilesets/reference/mapbox-terrain-rgb-v1/

Functions§

decode
Decode a flat width × height × 3 RGB buffer back to elevations.
decode_pixel
Decode a single Mapbox Terrain-RGB (R, G, B) pixel into elevation (metres).
encode
Encode elevations (metres) into a flat width × height × 3 RGB buffer.
encode_pixel
Encode a single elevation sample (metres) into Mapbox (R, G, B).