I am trying to combine 2 rasters: one with values = 1 and the other with values = 0 because I need a final raster with no empty cells. When I use the Raster calculator, the resulting raster only retains the cells with value = 1. It ignores cells with value=0 so therefore I now have a new raster with many No Data cells. How do I combine these 2 rasters and maintain both value = 1 and value =0, preferring value =1. Using ArcGIS 10.2.2

  • 1
    What GIS software are you using the raster calculator from?
    – PolyGeo
    Dec 14, 2015 at 4:28
  • try Raster Calculator with Con function but be sure that 0 isn't set to nodata and the spatial references match... A picture of what you're trying to achieve might help here. Dec 14, 2015 at 5:12

1 Answer 1


Assuming the problem, is that the extent of your two rasters are not the same(mismatching nodata cells during overlay), and also that you are using ArcGIS:

Con(((IsNull(Raster0)) & (Raster1 ==1)), 1,Con(((IsNull(Raster1)) & (Raster0 ==0)),0,Con((Raster1 ==1) & (Raster0 ==0),1,-1)))

OR | difference below is that I used the rasters themselves as a true statement rather than the constant 1 and 0.

Con(((IsNull(Raster0)) & (Raster1 ==1)), Raster1,Con(((IsNull(Raster1)) & (Raster0 ==0)),Raster0,Con((Raster1 ==1) & (Raster0 ==0),Raster1,-1)))

You can then use setnull to convert all areas that are marked -1 into nodata, but I doubt that there will be any combination left to be assigned as -1.

Your Answer

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

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