[gdal-dev] gdal_calc.py and NoData issues

Andreas Neumann a.neumann at carto.net
Wed Nov 19 06:13:15 PST 2014


Hi Simen,

<> means not - same as !=

Andreas

Am 2014-11-19 15:09, schrieb Simen Langseth:
> I saw the symbol <> first time in gdal calc what is meaning of it?
> 
> Thanks
> 
> On Wed, Nov 19, 2014 at 10:21 PM, Even Rouault
> <even.rouault at spatialys.com> wrote:
> 
>> Le mercredi 19 novembre 2014 14:16:05, Andreas Neumann a écrit :
>>> Hi Even,
>>> 
>>> Thank you for trying to help. Unfortunately, the --overwrite
>> option does
>>> not help.
>>> 
>>> I have a very small test file at
>> http://webgis.uster.ch/temp/test.tif [1]
>>> 
>>> I used the following options:
>>> 
>>> gdal_calc.py -A test.tif --overwrite --outfile=testcalc.tif
>>> --calc="(A==249)*255+(A<>249)*A"
>>> 
>>> All pixels with values of "255" are now "nodata" after running
>> gdal_calc
>>> ;-(
>> 
>> I wrote "as well", so try with "--overwrite --nodata 99".
>> 
>>> 
>>> May I please ask you to test/verify this?
>>> 
>>> Thanks a lot!
>>> 
>>> Andreas
>>> 
>>> Am 2014-11-19 13:58, schrieb Even Rouault:
>> 
>>>> Le mercredi 19 novembre 2014 13:49:48, Andreas Neumann a écrit
>> :
>>> >> Hi,
>>> >>
>>> >> I have an issue with gdal_calc.py and nodata values.
>>> >>
>>> >> My input data contains a lot of white pixels. After running
>>> >> gdal_calc.py
>>> >> with the following parameters
>>> >>
>>> >> gdal_calc.py -A test.tif --outfile=testcalc.tif
>>> >> --calc="(A==249)*255+(A<>249)*A"
>>> >>
>>> >> 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.
>>> >
>>> > Use --overwrite as well, since otherwise the existing output
>> file will
>>> > be used
>>> > to be just updated and not recreated.
>>> > It would be appropriate that the utility warns that
>> --NoDataValue has
>>> > no effect
>>> > when the output file exists.
>>> >
>>> >> Thanks for any hints,
>>> >> Andreas
>>> >> _______________________________________________
>>> >> gdal-dev mailing list
>>> >> gdal-dev at lists.osgeo.org
>>> >> http://lists.osgeo.org/mailman/listinfo/gdal-dev [2]
>> 
>> --
>> Spatialys - Geospatial professional services
>> http://www.spatialys.com [3]
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev [2]
> 
> 
> 
> Links:
> ------
> [1] http://webgis.uster.ch/temp/test.tif
> [2] http://lists.osgeo.org/mailman/listinfo/gdal-dev
> [3] http://www.spatialys.com


More information about the gdal-dev mailing list