I have a raster with null data. I want to create a mask for where ever I have values in my raster. (not null cells) When I use translate(convert format) in qgis (Raster-->conversion--> translate)to transfer the no data in the original file to 0, instead of changing nodata to 0, it is changing them to -999!

And when I use raster calculator and divide the raster by itself to create mask and then using translate to convert null data to 0, the tool convert the null values to 3.4028234663852886e+38. How I can fix this problem?

  • Your input raster has both values pixels and pixel with null value? – Cushen Jun 29 '18 at 7:31

I am making an assumption that:

  • Originally, NoData value of your raster layer was -999.
  • On Translate (convert format) window, you chose No Data option and set it to zero (0).

All 0 cells are now regarded as NoData cells in your new layer, while -999 cells became visible.

Your second raster calculation involved division by zero (i.e. current NoData), then QGIS returned maximum value for float (3.4E+38).

Having said that, what you are trying to do is change -999 to 0. You can do it by Raster calculator, but if it fails, consider using SAGA Reclassify values tool in the Processing Toolbox.


To create a raster layer with values wherever your input raster is not null, do the following in raster calculator:
You can also convert format using this process if that is why you were using translate before

(“RASTER_NAME” is not null ) = 1  

raster Calculator Mask not null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.