I am trying to merge two rasters (.tif) in QGIS (Raster > Miscellaneous > Merge), but only one of the rasters is kept in the output.

I need a 3rd rasters with the sum of the values from both input rasters.

So to 'Place each input into a separate band' is not an option. The rasters overlap completely and have the same resolution. The values of each cell are 0 or 1. The third raster should have values of:

  1. Zero, when a cell from both rasters have a value of zero
  2. One, when one cell has value 1 in one raster and 0 in the other
  3. Two, when a cell from bothe rasters have a value of 1

When I try to merge as described above, the resulting raster is exactly the same to one of the preceding rasters.

I've already tried the to re-saved my .tifs but with a lower resolution (as suggested here) with no success. I'm running QGIS 3.0.1 in Windows 10.

  • 2
    Can you please elaborate on your problem a bit and add screenshots if possible? How much, if at all, do your rasters overlap? Saying you want to "combine values" is somewhat vague, and could mean a number of different things.
    – jcarlson
    May 24, 2019 at 16:37
  • Thank you for your quick answer and sorry for the delay from my side. I edited the question to add more details, hope it is alright now. What kind of screenshots do you suggest? Sadly I cannot put an image of the rasters here because they are protected by confidentiality. But I could, if at all usefull, upload screenshots of the gui interface for the merge function.
    – ppp
    May 27, 2019 at 15:45
  • Do the rasters have the same projection? May 27, 2019 at 15:48

1 Answer 1


You need to use Raster Caluclator for this. Do a simple addition as for example:

"IMG1@1" + "IMG2@1"

enter image description here

The Merge function combines several rasters into one. Also called "Mosaicing". This is useful if you want to merge several files into one, when they lay next to each other. If they overlap, the last raster will lay on top. Also see https://gdal.org/programs/gdal_merge.html Using Raster Calculator you can do (almost) all kinds of mathematical calculations on your rasters, as you need to do in your case.

  • Thanks for your answer and your explanation, it works fine. Also, thanks for pointing out when to use the Merge function.
    – ppp
    May 28, 2019 at 16:16

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.