Combine and Intersect two rasters

4465
6
Jump to solution
09-28-2016 07:46 PM
GwanSeonKim
New Contributor II

Hi GIS users,

I have two different rasters as below

First raster shows all green pixels, and second raster shows other color pixels. 

I would like to delete pixels if the pixels are located out of green pixels. 

I tried to use clip and mask tools, but I could not delete those pixels. 

What tool should I used to solve this problem?

Please help me!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

What happens if you write the following expression in Raster Calculator?

Con(("RASTER1" > 0), "RASTER2", 0)

where RASTER1 = Green Raster

Raster2 = Multicolour Raster

If required, you can set the NoData Value as 0 in tool Environment setting.



Think Location

View solution in original post

6 Replies
GwanSeonKim
New Contributor II

Thank you so much your response.

I tried used code that Con(("Raster_A" == 1) & ("Raster_B" == 1), 1, 0), and it works OK.

In Raster_A, I have 3 different objectives as shown in attached picture (pixels with Orange, Brown, and Purple colors). 

I would like to keep 3 different objectives in Raster_A and just delete pixels if pixels are not located within Raster_B.

I tried to use Con(("Raster_A" == 1) & ("Raster_A" == 2) & ("Raster_A" == 3) & ("Raster_B" == 1), 2, 1, 0), but it gives me an error message. Do you have any ideas to deal with this problem?

Thanks again. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

Con(("Raster_A" == 1) & ("Raster_A" == 2) & ("Raster_A" == 3) & ("Raster_B" == 1), 2, 1, 0)

why not if raster_A is <= 3.  Also a cell cannot be class 1, 2, 3 all at once which you mean when using & you want 'or' specifically boolean or, not bitwise or   

|—Spatial Analyst module | ArcGIS for Desktop  that is what | is... it isn't a big i 

JayantaPoddar
MVP Esteemed Contributor

What happens if you write the following expression in Raster Calculator?

Con(("RASTER1" > 0), "RASTER2", 0)

where RASTER1 = Green Raster

Raster2 = Multicolour Raster

If required, you can set the NoData Value as 0 in tool Environment setting.



Think Location
GwanSeonKim
New Contributor II

It works perfectly.

Thank you so much.

JayantaPoddar
MVP Esteemed Contributor

Glad it worked!!!



Think Location
0 Kudos