My goal is to host tiles with elevation values in GeoServer.
I downloaded the mapzen tiles (link here: https://www.opentopodata.org/datasets/mapzen/)
Originally downloaded for use in opentopodata. I set up everything and launched it successfully.
But now I want to use the same GeoTIFF with GeoServer. The problem is that if you just put this GeoTIFF in a layer, then GeoServer cannot return the tile and writes an error in the log. As I understand it, GeoServer cannot work with GeoTIFF, which has 1-band and values in which exceed one byte per band as in RGB.
As a result, I came up with the idea to convert these 1-band Geotiff to RGB. I want to encode the full elevation value in RGB.
The essence of the transformation is as follows: RGB (R = 1 byte) (G = 1 byte)(B = 1 byte)
https://www.checkyourmath.com/convert/color/decimal_rgb.php
I tried using gdaldem color-relief and at first this utility seemed like a salvation, but in fact it turned out that this utility is not designed to accurately replace colors, it does it only approximately, and loses colors that go in order. It works more or less normally with a set of brightly highlighted colors, but at the same time the idea is lost that you can simply calculate the value of the elevation by the RGB value, which goes linearly according to the above.
Since gdaldem color-relief did not justify itself for the task described above, unfortunately, I am thinking of writing a utility that will replace each pixel in the original GeoTIFF (1-band) with RGB with a lift value encrypted in 3 bytes. But I don't know how to approach it yet.
As often happens, I wrote a topic in the forum and almost immediately found the answer.
Solution: still gdaldem color-relief. But exclude interpolation, which loses a lot of data.
As a result, everything turns out clear and all the colors are in place.