Finding intersection of two rasters

I have two raster images, Boolean classified (1 or 2). They overlap in given areas. I need a raster that is only the overlapping sections.

Using ArcInfo 10. Answer can only use raster methods, no converting to polygons, points, etc...

• Both Answers are correct, the first is more elegant but I decided to give the second credit as it was the most helpful for me.
Commented May 22, 2012 at 13:19

This seems like a pretty simple clipping operation. Use the Clip (Data Management) tool.

From the help documentation:

An existing raster or vector layer can be used as the clip extent. If you are using a feature class as the output extent, you have the option to clip the raster by the minimum bounding rectangle of the feature class or by the polygon geometry of the features. If clipping geometry is used, then the pixel depth of the output may be promoted. Therefore, you need to make sure that the output format can support the proper pixel depth.

This should actually be simpler than your requirement as it uses core functions and should not even require the Spatial Analyst extension, as other methods might.

-------------- Edit

On the other hand, if your goal is to create a raster that shows where both inputs were null, or either one had a value, or both had a value, then you would use Raster Multiplication. This essentially creates an output raster that has values which are the multiples of the values of the input rasters. Note that what follows requires the Spatial Analyst extension.

An example, in your case, with boolean rasters.

``````Raster 1:  1,2
Raster 2:  1,2

Output Raster:  Possible combinations:  1x1,1x2,2x1,2x2 with output values: 1,2,4
Value 1:  Both Boolean False
Value 2:  1 or the other, Boolean True
Value 4:  Both Boolean True
``````

If you want to be able to determine which of your inputs has a true value, you will need to reclassify one of the input rasters so that your multiplied values are completely unique. Both inputs will need to be reclassified so that there is no Value of "1", as this will allow for duplicate values in a multiplied raster.

Example:

``````Raster 1: 1,2 - Use [Raster Addition][4], with a constant of 1 - Output Raster 3
Raster 2: 1,2 - Use [Multiply Raster][5], with constant of 2 - Output Raster 4
Raster 3: 2,3
Raster 4: 2,4

Now, multiply Raster 3 and Raster 4
Output Raster:  Possible Combinations:  2x2,3x2,4x2,4x3 with output values: 4,6,8,12

Value 4:  Both Boolean False
Value 6:  Raster 3 True, Raster 4 False
Value 8:  Raster 4 True, Raster 3 False
Value 12: both Boolean True
``````

You could do a combination of these operations where you clip one of the rasters by the other, to only show the overlapping area. Then reclassify and multiply the rasters to show where both are False, one or the other are True, or both are True.

Hope this helps.

• I keep getting an output extent error. Or a mask error. So frustrating.... Never run into this before.
Commented May 22, 2012 at 11:13
• nvm. I think i'm I have a projection issue. i.e. these functions don't support on the fly projecting... therefore they don't overlap as far as the functions concerned.
Commented May 22, 2012 at 11:43
• @Thad - I would then try reprojecting one of the rasters to match the projection of the other. Use the Project Raster tool found under the Data Management tools. Or, use the python code to do so programmatically as part of your workflow. Commented May 22, 2012 at 21:42
• yeah I did that and it worked perfectly.
Commented May 23, 2012 at 11:06

I assume that in your rasters you have value 1 for white (in some way nodata area) and 2 for blue/green.

So, you need to get areas where both rasters have value 2.

This can be easily performed with Raster Calculator in ArcGIS.

Expression will look like:

`("raster1" == 2) & ("raster2" == 2)`

or

`Con(("raster1" == 2) & ("raster2" == 2), 1, 0)`

PS this tool requires Spatial Analyst extension

1. `arctoolbox >> Data management tools >> Raster >> Rasterprocessing >> Clip` drag and drop your raster in input and output (no matter which one). Now you have a shapefile from your overlap area (we called it overlap.shp).
2. using extract by mask, for both rasters: `arctoolbox >> Spatial analyst tools >> Extraction >> Extract by mask`: input: the Raster 1, mask data: the overlap.shp. Now you have a raster of overlap raster 1 (we called it overlap1). `arctoolbox >> Spatial analyst tools >> Extraction >> Extract by mask`: input: the Raster 2. mask data: the overlap.shp. Now you have a raster of overlap raster 1 (we called it overlap2).
3. the last step: `arctoolbox >> Spatial analyst tools >> Map algebra`: drag and drop overlap2 & overlap1.