Raster Intersect/Union

194
7
10-17-2021 01:51 PM
GraceManks
New Contributor

Hello! 

I am working with raster for the first time. For an assignment, we need to create two raster layers and find the areas that do not overlap. 

When we used vector data, we could union and intersect the areas in order to find this out. I was wondering if there are equivalent tools for raster that I could use to achieve the same outcome?

Thank you! 

0 Kudos
7 Replies
DanPatterson
MVP Esteemed Contributor

Con (Spatial Analyst)—ArcGIS Pro | Documentation 

Conditional evaluation with Con—ArcGIS Pro | Documentation

The key is to set the analysis extent through the Environments tab to the combined extent (union) of both rasters.  If both rasters overlap assign them a value of 1 otherwise 0


... sort of retired...
GraceManks
New Contributor

@DanPatterson 

I have now set the extent to union of inputs! Thank you!

If I had a layer called "total_land", and the overlapping areas I want to remove from it are called "town_distance" and "lake_distance", would I use do outras="total_land"-("town_distance"+"lake_distance") or is there a conditional equation I should be using instead? 

I've never used conditional before so am finding it quite confusing!

Thank you!

0 Kudos
DanPatterson
MVP Esteemed Contributor

You said you had two raster layers,  Is one total_land ? and is town_distance and lake_distance two other rasters or just one?

Conditional statements are just logic.  If town_distance or lake_distance (TD_LD) has a value ( eg.  > 0, assuming 0 is the smallest value) and total_land has a value (eg > 0, again assuming 0 is the smallest value), then

if ....  (total_land > 0) and (TD_LD > 0), do this if True, do this if False) 

ergo

Con((total_land > 0) and (TD_LD > 0), 1, 0)

0 is the areas that don't overlap.  This is why it is important to set the analysis extent to the union of both rasters.  Another snag, is nodata values in either raster... I would reclass nodata to some value prior to applying Con ... longish story, but think on it) 


... sort of retired...
0 Kudos
GraceManks
New Contributor

Thank you I will try that now! And I said two layers for simplicities sake... There are actually quite a few layers going on unfortunately!

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Also check this out in Raster Calculator

 

Con((IsNull( "image1.tif") & IsNull("image2.tif")),0,(Con((IsNull ( "image1.tif") | IsNull("image2.tif")),1,2)))

 

Replace image1.tif and image2.tif with your raster file names.

In the resulting raster, ignore the cells with value 0.

Cells with Value 1 are the ones where overlapping cells of any one of the two layers is Null.

Value 2 indicates both the overlapping cells are not Null.

You could open the attribute table to see the count of cells in each value.



Think Location
0 Kudos
SafaÜzümcü
New Contributor

 

         Kırmızı kare test alanlarının altında bir raster dosyası var. Raster dosyasında siyah mı yoksa yeşil mi olduğunu daha fazla bilmek istiyorum. insect komutunu çalıştıramıyorum. Nasıl yapabilirim?

 

0 Kudos
SafaÜzümcü
New Contributor

There is a raster file under the red square test areas. I would like to know more if it is black or green in the raster file. I can't run the insersect command. How can I do it?

0 Kudos