QGIS – Changing NoData Pixels of -3.40282347e+38 to Different Number in QGIS

nodataqgis

I have a raster file with two different nodata values: -32768 and -3.40282347e+38. This happened because I am using -32768 as my nodata value, and the georeferencer in QGIS adds nodata pixels as -3.40282347e+38. I would like to have all my nodata pixels as a single value, which I would like to be -32768.

If the no data value is -32768 (or any other reasonable number), it is easy to change the value of the no data pixels into any other number using the raster calculator in QGIS.

NOTE: For this to work, you first have to uncheck "No data value" in the Transparency window of Layer Properties, otherwise the raster calculator won't recognize the no data pixels.

To change nodata pixels with a value of -32768 to -999 using the raster calculator, you can use the following formula:

("RasterFileName@1"=-32768)*(-999)+("RasterFileName@1"!=-32768)*("RasterFileName@1")

However, this will not work for nodata pixels with a value of -3.40282347e+38. The raster calculator does not recognize these pixels, and they do not get changed.

I thought that this might because the raster calculator did not like the format of -3.40282347e+38, so I tried using the raster calculator to change any pixel that was less than -10000, using the following formula:

("RasterFileName@1"<-10000)*(-999)+("RasterFileName@1">=-10000)*("RasterFileName@1")

This correctly finds all the pixels that are -32768, but still ignores the pixels with a value of -3.40282347e+38.

Is there any way to get the raster calculator to recognize pixels with a value of -3.40282347e+38? Or some other strategy of getting rid of this noxious number?

Best Answer

If you start QGIS with GRASS, you can use r.null from processing toolbox. Enter the value you want to change and its new value.

enter image description here