2

I am trying to change the null values of a raster from -32768 to -3.40282e+38 in QGIS. I tried using warp tool setting the no data values to my desired number but it did not change it. Then I used the translate tool and didn't change it either... I tried using r.null to in grass and it change it to 2.14748e+09 I don't know another method or what should I try to change?

  • 1
    You could try QGIS raster calculator, first get rid of NoData value then change < 32000 to your intended value then set nodata value to intended value.. – Michael Stimson Apr 23 '15 at 5:29
  • 1
    To elaborate on @MichaelMiles-Stimson; to get rid of no data you can use reclaissify – dof1985 Apr 23 '15 at 6:38
  • 1
    You should take a look at your raster data type (-32768 look like 16bit signed integer, 2.14748e+09 will suite 32bit integer - those are extreme values for those datatypes). Value of -3.40282e+38 requires sth much bigger than regular integer. – jzol Apr 23 '15 at 11:47
4

In this test raster (20x20), with values between 1 and 50, I replaced 19 value by -32768 value.

enter image description here

In the following raster, the -32768 values were replaced by -3.40282e+38 values (see window of Value Tool Plugin):

enter image description here

The used expression is in the window of "Raster calculator expression" (below image and code sample):

enter image description here

("null_values@1"=-32768)*(-3.40282e+38)+("null_values@1"!=-32768)*("null_values@1")

These changes were verified with Value Tool Plugin (below image). Blue areas have the original values of test raster.

enter image description here

  • It worked! Thanks a lot! It was really useful I have one more question... what does the "!" sign mean in the expression? – Nadia Apr 23 '15 at 17:36
  • The operator != means: 'different to', 'not equal to'. In this context: "if the cell of raster is different of -32768 then multiply one (because is TRUE) by the corresponding cell raster value". – xunilk Apr 23 '15 at 17:44

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.