How to merge two or more rasters with values 0 and 1, where the value 1 does not overlap with other rasters. Finally, I want one raster file with pixel values 1 from all raster files as 1 and the rest 0.

  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq.
    – underdark
    May 5, 2017 at 19:44

1 Answer 1


This should be straight-forward with a raster calculator. You could use an OR statement to generate a raster with output=1 wherever inputA=1 OR inputB=1. You could also do a simple sum (add the values of the two inputs). If the 1 values really do not overlap (both inputs never have 1 in the same pixel), then you can probably get away with just summing the two rasters, since the result of the addition should always be 0 or 1. If there is overlap, and some pixels end up with values of 2 or higher, then you can use a threshold to reduce the larger values back down to 1.

The details of how to do this depend on which software you're using (QGIS, ArcGIS, gdal, etc.).

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