1

I am making a model in ModelBuilder and there is a problem with Raster calculator result. I have to rasters with 0 and 1 values, I want to know where do they intersect and make a new raster with value 1 in that places. In Raster calculator I put the expresion like: raster1 * raster2. The problem is that it returns empty raster (with 0 values only), but when I look at rasters I can clearly tell that they do intersect.

enter image description here

Does anyone know what the problem can be?

  • 1
    Make sure the projection are the same, just in case – gisnside Apr 4 '17 at 13:06
  • There is same projection, but thanks to your comment I will check the resolution. – W. Tom Apr 4 '17 at 13:20
  • That could also be a good reason :) – gisnside Apr 4 '17 at 13:23
4

In order to do what you are trying to achieve you need to do a 2 step process:

  1. Use Raster Calculator and calculate Raster1 + Raster2.

This will give you a new raster with:

Values of 0 where both Raster1 and Raster2 have values of 0.

Values of 1 where one of Raster1 or Raster2 has a value of 1 and the other has a value of 0.

Values of 2 where both Raster1 or Raster2 have a value of 1.

The cells with a value of 2 are the ones you are interested in. But you said you want these to have a value of 1.

  1. You can now use the Reclassify tool to reclassify your new raster. Using this tool you can reclassify you raster so that all values of 2 become 1.

Depending on what you are trying to do, you might also need to reclassify the cells with a value of 1 to something else so that you can still differentiate between these and your new value 1 cells.

  • Sorry, I made a typo, I want new raster values to be "1" where old raster values "1" intersects and "0" in other cases. – W. Tom Apr 4 '17 at 13:19
  • Have changed my answer accordingly. When using the reclassify tool, just reclassify the 2's to a 1. – Dan_h_b Apr 4 '17 at 13:37
  • It sounds like OP's problem was unrelated, but in the general case, why would we expect addition to work when multiplication fails? Is this a workaround to a known bug with multiplication, or is something else at play? – Joe Apr 4 '17 at 15:29
  • This doesn't seem to be what the OP wants. The OP seems to be interpreting 0 as "no value at this location." So "intersection" would be the cells where both rasters have a non-zero value, no? – jpmc26 Apr 4 '17 at 17:18
2

There was a problem with different resolutions :) The problem is solved

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.