11

Is there a way to set all the 0 value pixels on a raster to nodata using GDAL?

I would like to use fillnodata to fill some holes, but holes are set to 0, so I need to delete them first

11

You could try something like this with gdal_translate

gdal_translate -of GTiff -a_nodata 0 input.tif output.tif
4

with gdal:

  1. gdalbuildvrt -of GTIFF -srcnodata 0 input.tif myVrt.vrt
  2. gdal_translate -of GTIFF -scale -a_nodata 0 myVrt.vrt output.tif

beside this you can use raster calculator plugin or grass in qgis too. and arcpy SetNull method.

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.