[GIS] Clip raster by raster in ArcMap

arcgis-desktoparcmapclipraster

How can I get two different raster layers in ArcMap, that have exact the same edge?

I tried clipping or extract by mask but the output looks exactly like the input.

I only want to have these values that have a cell in the other raster.

In other words: I have a red and a black raster. In the first image I want to get rid of the black cells of the underlying raster. In the second image I want to get rid of the red cells of the underlying raster.

enter image description here

enter image description here

Best Answer

Have you thought about working with NoData values? If they are not properly labelled already, you could assign the white cells to the raster mask. That can be achieved for example by using the Copy Raster tool to modify the NoData Value.

You could also use the Raster Calculator to create a Mask raster using operations like AND/OR (something like "raster1 == 255" | "raster2 == 255" assuming that white = 255 in your screenshots)

Once you have this sorted you should be able to perform an Extract By Mask using the new raster with NoData values as a mask.

Edited solution after the additional information provided in the comment:

SetNull((IsNull("raster1") | IsNull("raster2")) == 1, "raster1"), then SetNull((IsNull("raster1") | IsNull("raster2")) == 1, "raster2") using the Raster Calculator tool should do the trick

Related Question