Strange encoding, -10000 meters isn't deep enough for the Marianas Trench. You could borrow another 10 km from the 1.6 million meters still available on the positive side.<div><br></div><div>Scaling by 0.1 also means a 10 cm vertical resolution., which is useless for some use cases. The 24 bits per pixel could be much better allocated.<br><div><br></div><div>Ray<br><br>
<br>
<br>
<div class="gmail_quote flockmail-quote flockmail-quote-id-<634f076d-441f-457e-aaca-7ebeb3f270be@spatialys.com>">
<div dir="ltr">On Mon, 5 Jan 2026 at 6:50 AM Even wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><pre>Hi Lars,
I would rather see that as a standalone TerrainRGB raster driver,
leveraging the PNG driver underneath.
For the read side, if one is desired (write-only drivers are possible),
is there a way in metadata or file naming of distinguishing a regular
RGB PNG file from a Terrain-RGB one? If not, the Identify() function
should rely on users providing a "TerrainRGB:" prefix or specifying
explicitly the driver in the GDALOpenInfo::papszAllowedDrivers member
(testable with poOpenInfo->IsSingleAllowedDriver("TerrainRGB") )
Even
Le 05/01/2026 à 15:15, Lars Ahlzen via gdal-dev a écrit :
> Hi all,
>
> For Open/WebGL-based client side map rendering libraries, like
> MapLibre or Mapbox GL, Terrain-RGB [1] (original spec by MapBox I
> believe) seems to be the elevation encoding of choice.
>
> The encoding itself, meant for use with 8-bits per channel RGB raster
> formats such as PNG tiles, is straightforward:
>
> elevation (in meters) = -10000 + 0.1 * (R * 65536 + G * 256 + B)
>
> As far as I know a separate tool is typically used for the encoding,
> such as rio-rgbify [2] from Mapbox. There's an example writeup of such
> workflow at [3]. Perhaps the same thing could also be achieved using
> the raster calculator (gdal_calc), but that seems far from trivial for
> most users.
>
> It looks like it would be relatively easy to add native support for
> this in GDAL, perhaps as another mode in gdaldem. Would it make sense
> if I gave that a try?
>
> - Lars
>
> [1] https://blog.mapbox.com/global-elevation-data-6689f1d0ba65
> [2] https://github.com/mapbox/rio-rgbify
> [3] https://github.com/syncpoint/terrain-rgb/blob/master/README.md
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev
</pre></blockquote>
</div></div></div><img class="flm-open" width="0" height="0" style="border:0;width:0;height:0;display:block;" src="https://gateway-east.rootserverlink.com/dc/t/mo/v2?t=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJwIjoiMTAwMiA0NDkxNzExIGdkYWwtZGV2QGxpc3RzLm9zZ2VvLm9yZyAwM2E2MDdlNDhkZDk0OTIxZDkwY2MyODAyNGU5MDM1OSA0MjQyNTgyNjgzMTQ2NjQ5OCAxID8iLCJleHAiOjE3ODMxOTQ0MzN9.zV_i_-QhES6vjznCpxKBEGb9WqIkAgn-OWJKvUWY3ZJ-dMA35z9oavVDMTt_re-4hgBg1Vj1owMh1P9xFviznA&requestId=i_05194700_SMR_554_F79_TcKT">