[QGIS-Developer] GDAL-warp and gdal-translate strange behaviour regarding output NODATA vaue

Even Rouault even.rouault at spatialys.com
Thu Jul 8 20:25:26 PDT 2021


By design, only speaking about behaviour of the GDAL utilities themselves:

- gdal_translate -a_nodata just modifies the nodata metadata, and 
doesn't alter pixel values

- gdalwarp [-srcnodata xxx] -dstnodata yyy modifies the nodata metadata 
and pixel values

Le 09/07/2021 à 01:02, Alexandre Neto a écrit :
> Hi,
>
> I was quite surprised with the behavior of gdal_translate (in clip 
> raster by extent) and gdal_warp (reproject) when the user sets up an 
> output nodata value different from the original nodata value of the 
> input files.
>
> My intuition was telling me that by using that option, all the old 
> nodata pixel values would be transferred to the new nodata values. So, 
> if I have a raster with nodata = -3.40282e+38 and I use as output 
> nodata value -9999, I would expect that all -3.40282e+38 pixels would 
> be converted to -9999 and considered to be NODATA. But I was wrong. By 
> doing this, I ended up with rasters containing pixels with actual 
> -3.40282e+38 value, no longer considered as nodata.
>
> Is it just me that finds this unexpected?
>
> On the other hand, if you use the same similar option in the DGAL 
> raster calculator it works as (I) expected.
>
> Best regards,
>
> Alexandre Neto
> User Support
> www.cooperative.net <http://www.cooperative.net>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
http://www.spatialys.com
My software is free, but my time generally not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210709/c8ebd4e9/attachment-0001.html>


More information about the QGIS-Developer mailing list