mapbox / rio-rgbify

Encoded arbitrary bit depth rasters in pseudo base-256
MIT License
103 stars 38 forks source link

can't fully understand the '-interval' params #31

Open geocian2 opened 3 years ago

geocian2 commented 3 years ago

can't fully understand the '-interval' params

andrewharvey commented 3 years ago

It affects how the height is encoded into RGB values.

For example Mapbox's Terrain RGB format derives the height with

height = base + ((R * 256 * 256 + G * 256 + B) * interval)

where base is -10000 and interval is 0.1.

So if you want your data compatible then you'd use those values.

Mapbox's formula means you only get 0.1 meter height precision (ie. the interval). If your application needs more precision you might decide to decrease this value but to compromises you'll get less range so won't be able to record the full range of heights on earths surface.