[gdal-dev] gdal_calc.py else not 0

Benjamin_P benjamin.preisig at metgis.com
Thu Sep 18 04:56:42 PDT 2014


I found a workaround for my problem:

First get all zeros in the original file with:
gdal_calc.py -A original_file.tif --outfile=zeros.tif --calc=A==0
--> results in a file where ther former zero cells have a value of 1 and all
other cells 0

Then combine the temporary file with the original file:
gdal_calc.py -A original_file.tif -B zeros.tif --outfile=noZeros.tif
--calc=A+B
--> Add the values of both files. Now we add 1 to the former zero cells, the
other values are not affected.

Benjamin



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-calc-py-else-not-0-tp5162590p5162612.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list