1

I start with a bunch of 1-bit geotiff files that I had to convert to 8-bit RGB tiff files to use with GDAL. Then I tried to set borders to red (content is in black and white so I can't use those) and do

gdal_translate -a_nodata '200 0 0' -of vrt red.tiff nodata.vrt

gdalbuildvrt -srcnodata '200 0 0' -vrtnodata '200 0 0' -hidenodata -addalpha nodata.vrt trans.vrt

gdal2tiles.py -a "200,0,0" trans.vrt ...

But I am only able to hide nodata if it is in grayscale(ex. rgb(200,200,200)) I think the color information is just lost in the gdal_translate process. Is there any way to verify what happened and make gdal work with nodata that has custom colors?

1

You can verify what GDAL interprets as nodata with gdalinfo

gdalinfo red.tiff
gdalinfo nodata.vrt
gdalinfo trans.vrt

Take also care to use a recent GDAL version. There was a bug that made GDAL to read sometimes only the first value of nodata and repeated it to the rest (200 0 0 -> 200 200 200). Unfortunately I could not find when it was corrected but GDAL 1.10 or higher for sure does not have this bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.