This example use a TileWMS layer with an x-bil (Band Interleaved by Line) image format and a
tileLoadFunction
to encode altitude as RGB pixels.
The following equation will decode pixel values to height values:
height = -12000 + ((R * 256 * 256 + G * 256 + B) * 0.01)
It ensure a 2 digit precision and a maximum deep watter trench up to -12000 m.
Use the
ol.ext.getElevationFromPixel function to get elevation from RGB pixel value.