I'm attempting to add a few raster layers together, but the result is a solid black rectangle. To simplify things I tried adding a '1' to one raster only. Eg. for a raster layer callled prec9_23 I have the following formula:

"prec9_23@1" + 1

Even that gives a solid block, all with the same value. What might I be doing wrong?


You need to try to recalculate the statistical values of your data as you can see below:

For example, under Load Min/Max values, select Min/Max, then select Actual (slower) and full/current extent depending your data, then press Load.

After computing the Min/Max values of the pixels, click apply and see if the values were updated or not.

enter image description here


There is nothing wrong in your data. Here is the output:

enter image description here

The sample raster image is your original image, and the Result raster (the one displayed) is the output after adding a value of 1.

I did not do anything exceptional, I stretched your data to Min/Max, Actual(solwer) as I explained earlier, then pressed Load. Then I used raster calculator to add value of 1 to the sample image:

"sample_raster@1"  +  1

Then saved the output image as Geotiff. I repeated the above steps again of stretching the Result image to Min/Max, Actual(solwer), and pressed Load again.

That's all what I did.

I used QGIS 2.14.5. Try to update your QGIS version if you are using an older version.

|improve this answer|||||
  • I assumed you meant to do this on the resultant raster layer. I tried that and it's still a solid block of one value. – user81613 Sep 9 '16 at 2:04
  • Can you share a small portion of your data to test it? – ahmadhanb Sep 9 '16 at 2:09
  • link I saved a layer I was testing with as a Gtiff and uploaded to the link above. </p>I tried adding the value 1 to the layer and then recalculating statistical values, and I also tried recalculating first and then doing the addition, with the same result. Thanks – user81613 Sep 9 '16 at 2:21
  • I tried to download your data but I couldn't find any link. Can I download the data or it is just for viewing? – ahmadhanb Sep 9 '16 at 2:38
  • Please try this link: link </p> As text: mediafire.com/view/hlljb3wvl6gb8wt/sample_raster.tif – user81613 Sep 9 '16 at 2:45

Check whether the raster you are trying to add has NULL or No Data values represented by # in some of the pixels. I had the same problem and solved by replacing NULL values with 0.

|improve this answer|||||
  • I'm not sure how to check that other than a clicking around. I have -9999 for the No-Data value which I can see from 'layer info' in the General tab – user81613 Sep 9 '16 at 2:27

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.