[gdal-dev] gdal_calc.py and NoData issues

Graeme B. Bell grb at skogoglandskap.no
Thu Nov 20 03:47:03 PST 2014


Andreas,

>it turns out that all pixel values with 255 are now nodata values ;-( Is 
>there an option so that my 255 values are not turned into nodata? I 
>tested with the --NoDataValue option (e.g. 99 - which I don't use in the 
>image), but it seems to be ignored. For me it is important that black 
>and white pixels are preserved.

I submitted a patch to help with this sort of thing to the GDAL team 17 months ago which is unfortunately being blocked/ignored longterm for (what I consider to be) very unwise reasons.

https://trac.osgeo.org/gdal/ticket/5130

In the meantime I suggest you can download this alternative version that will give you full control over how nodata in controlled across multiple rasters. It's only a couple of lines patched from the original version. We use it on national scale rasters here with very complex functions, but it works just as well for easy functions.

https://github.com/gbb/gbb_gdal_calc

Graeme.


More information about the gdal-dev mailing list