2

So I am trying to join/merge two raster layers that have values of either 1 or 0. I am using the following command in in ArcGIS Raster Calculator:

Con(("urban" == 1) | ("mixed" == 1), 1, 0)

The new raster layer is missing cells from the "urban" raster layer, I have no idea why this is happening.

I have also tried the following commands with the same result:

("urban" == 1) | ("mixed" == 1)

or

removing all the cells equal to 0 in both layers and then:

"urban" + "mixed"
  • Did you try to use " & " instead of " | " for combining the conditions? – Matte Feb 27 '17 at 12:29
  • 1
    I have tried that, a get a raster layer with cells only equal to 0. The cells that are equal to 1 in both layers are not overlapping, so there are no cases where both conditions are true, hence I am using "|" – Trashmonk Feb 27 '17 at 12:47
  • 2
    Have you tried simply adding the two rasters "urban" + "mixed" without removing the 0 cells? You'll end up with 0+1, 1+0 or 0+0. The result will be grid with 1s and 0s since urban and mixed are mutually exclusive. Removing 0s may be causing you trouble. – user92055 Feb 27 '17 at 16:26
2

This will work for your case:

Out_Raster = SetNull((Abs(IsNull("urban")-1)+Abs(IsNull("mixed")-1))<1,(Abs(IsNull("urban")-1)+Abs(IsNull("mixed")-1)))

Here is a part by part explanation:

  • IsNull("urban") returns 0 for data values and 1 for nulls.
  • Abs(IsNull("urban")-1) will make nulls into 0 and other cells into 1 by subtracting 1 and taking absolute value.
  • (Abs(IsNull("urban")-1)+Abs(IsNull("mixed")-1)) Compiles all 1 values from both datasets.
  • I then feed this ugly expression (UGLY_EXP) into a SetNull(UGLY_EXP<1,UGLY_EXP) to set all the 0 values to null and other cells to 1.
|improve this answer|||||

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.