4

I've a problem with the ArcGIS Raster Calculator:

I have two 2-Bit Rasters with the same extent, the only data stored in it are 1-values and NoData. Now I want to combine this two Rasters: If in layer one and/or two the value is 1, I want a 1 in my new raster. If the two layers are 0, it should be NoData.

I tried:

((Raster1 == 1) | (Raster2 == 1)) *1

Doesn't work, neither I don't know if this should be correct..

Con(((Raster1 == 1) | (Raster2 == 1)),1)

And the last one:

Con((Raster1 == 1), 1, Raster2)

All the time it returns me a new Raster which is only 1 if Raster1 AND Raster2 is 1. How should I do this? What's the mistake?

3

This has tripped me up a few times. You think you have access to all of Raster1 but the areas of NoData are instantly off limits to the rest of the operation. Try adding IsNull to the Con statement.

Con(IsNull("Raster1"), "Raster2", "Raster1")

I think that should work for you. Note that if both are NoData there will still be NoData and if that is not desired you will need to add more steps to make those areas into 0 values (similarly using IsNull should work well) if that is desired. Otherwise this should work for you if you prefer having the areas of NoData.

  • Yep, that was it. Important to know that that Raster Calculator is handling the NoData-cells this way. Thank you! – leFörster Jan 26 '16 at 15:36

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.