[gdal-dev] Trouble with gdaldem -exact_color_entry

Even Rouault even.rouault at spatialys.com
Wed Aug 14 03:45:18 PDT 2024


Hi,

There was indeed an issue with the -exact_color_entry mode. Will be 
fixed per https://github.com/OSGeo/gdal/pull/10596

As your input band is integer, you can safely use -nearest_color_entry 
or the default linear interpretation mode (potentially adding an entry 
"12 0 0 0 0" in case you want to map values >= 12 to transparent)

Even

Le 14/08/2024 à 08:28, Daniel Mannarino via gdal-dev a écrit :
> Hi all!
>
> I'm having trouble getting gdaldem to work the way I believe it's 
> supposed to. In particular I have given it a single-band uint8 GeoTIFF 
> and tried to map the values to RGB bands via a colormap using exact 
> matching, but the resulting GeoTIFF is invariably all zeroes (as if 
> there were no matches). Using -nearest_color_entry or not specifying 
> -exact_color_entry yields the expected results, but I only want exact 
> matches. I have tried specifying values to match as both floats (0.0, 
> 1.0, etc.) and ints (0, 1, etc.). Adding an alpha channel makes no 
> difference in this sense. Am I doing something wrong, or is there an 
> issue with gdaldem? Here are the commands I used, and a link to the 
> files in question:
>
> gdaldem color-relief -co COMPRESS=DEFLATE -co TILED=YES -co 
> BLOCKXSIZE=256 -co BLOCKYSIZE=256 -co SPARSE_OK=TRUE -co 
> INTERLEAVE=BAND -exact_color_entry -alpha foo.tif colormap.txt 
> exact_foo_with_alpha.tif
>
> gdaldem color-relief -co COMPRESS=DEFLATE -co TILED=YES -co 
> BLOCKXSIZE=256 -co BLOCKYSIZE=256 -co SPARSE_OK=TRUE -co 
> INTERLEAVE=BAND -nearest_color_entry -alpha foo.tif colormap.txt 
> nearest_foo_with_alpha.tif
>
> gdaldem color-relief -co COMPRESS=DEFLATE -co TILED=YES -co 
> BLOCKXSIZE=256 -co BLOCKYSIZE=256 -co SPARSE_OK=TRUE -co 
> INTERLEAVE=BAND -alpha foo.tif colormap.txt gradient_foo_with_alpha.tif
>
> https://drive.google.com/drive/folders/17q3zQAcOqPTo4f8-swWEgrpQ9sfufasR?usp=share_link
>
> These commands were performed with GDAL 3.9.1 installed on MacOS/ARM 
> via Homebrew, though the problem also occurs in our AMD64 AWS 
> instances running Linux and GDAL 3.8.4 with the official Docker images 
> as a base.
>
> Thanks for any help!
> Daniel Mannarino
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list