[gdal-dev] gdaldem color-relief geotiff alpha band nv value not working (take 2)

Homme Zwaagstra hrz at geodata.soton.ac.uk
Fri Aug 7 05:46:17 PDT 2015


Hi all,

This is a similar question to that posed in 
<https://lists.osgeo.org/pipermail/gdal-dev/2011-November/030880.html>, 
which didn't seem to be resolved on the mailing list.

Basically, I am running the following command:

gdaldem color-relief dhaka.tif colour-relief.ramp 
dhaka-colour-relief.tif -alpha -of GTiff -co COMPRESS=DEFLATE -co 
PREDICTOR=1 -co ZLEVEL=9 -co TILED=YES

colour-relief.ramp is as follows:

500    0   1   36
300    12  15  118
75     33  109 158
30     63  184 105
3      120 234 50
0      254 255 125
nv     0   0   0   0

dhaka.tif is as follows:

Driver: GTiff/GeoTIFF
Files: dhaka.tif
Size is 443, 217
Coordinate System is:
GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.257223563,
             AUTHORITY["EPSG","7030"]],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0],
     UNIT["degree",0.0174532925199433],
     AUTHORITY["EPSG","4326"]]
Origin = (90.314286342329481,23.848152313769823)
Pixel Size = (0.000833292764088,-0.000833299630454)
Metadata:
   AREA_OR_POINT=Area
Image Structure Metadata:
   COMPRESSION=DEFLATE
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  90.3142863,  23.8481523) ( 90d18'51.43"E, 23d50'53.35"N)
Lower Left  (  90.3142863,  23.6673263) ( 90d18'51.43"E, 23d40' 2.37"N)
Upper Right (  90.6834350,  23.8481523) ( 90d41' 0.37"E, 23d50'53.35"N)
Lower Right (  90.6834350,  23.6673263) ( 90d41' 0.37"E, 23d40' 2.37"N)
Center      (  90.4988607,  23.7577393) ( 90d29'55.90"E, 23d45'27.86"N)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
   NoData Value=nan

All files are available at <http://dropcanvas.com/yazx9>.

I find that the NODATA values are assigned the maximum colour value in 
dhaka-colour-relief.tif i.e. RGBA 0 1 36 255.

Changing the NODATA to -1 using `gdal_translate -a_nodata -1` does not 
seem to affect this outcome.  I have tested this using both GDAL 1.11.2 
and a recent trunk build on Linux.

Does anyone have any ideas on making the nodata value transparent in the 
colour relief output?

Many thanks,

Homme.



More information about the gdal-dev mailing list