I am attempting to add two rasters using the QGIS raster calculator and every output ends up as 'nan'. There were no problems with the raster calculator before trying to add these rasters, so I am stumped as to why it is not working with these rasters.

The code is:

"ForType@1" + "LandType@1"

Both rasters have the same projection and the pixel size are the same. It is a simple addition but any sort of calculation with these two rasters, whether addition or multiplication etc, ends up as no data.

Does anyone have suggestions as to why the raster calculator is not working? I am using QGIS 2.6.1, and other users have suggested updating the version to 2.10

  • Try out float("ForType@1" + "LandType@1").
    – xunilk
    Oct 23, 2015 at 21:26
  • Using float("ForType@1" + "LandType@1") results in -3.40282e+38 to -3.40282e+35
    – Adam Thom
    Oct 23, 2015 at 21:34
  • Sum each raster with it self: ("ForType@1" + "ForType@1") and ("LandType@1" + "LandType@1"). One of them probably have problems.
    – xunilk
    Oct 23, 2015 at 21:41
  • That method results in 'nan'. Both rasters show up okay, but do not work with the raster calculator
    – Adam Thom
    Oct 23, 2015 at 22:17
  • Well, I have the version 2.10 of QGIS and I don't have any problem. You decide then.
    – xunilk
    Oct 23, 2015 at 22:21

1 Answer 1


The Copy Raster tool in ArcGIS was used to convert the Pixel Type of one raster (8 bit unsigned) so that it matched the Pixel Type of the other raster (32 bit unsigned).

The Raster Calculator then worked perfectly to add the two rasters together.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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