Looking for a comparison tool, opposite to Diff

690
3
Jump to solution
07-31-2018 12:49 AM
AmericaZelada
New Contributor II

Hello, 

I have two rasters, and I'm looking to perform a pixel-by-pixel comparison.

If Raster A = Raster B, I want the output to be the value of Raster A (or B).

If they are different I want the output to be NaN, or 0.

Basically I need the opposite of Diff:

If the values on the two inputs are different  (EQUAL), the value on the first input is output. If the values on the two inputs are the same (DIFFERENT), the output is 0.

Any suggestions?

Thanks very much

EDIT:

I used raster calculator with this statement and it worked.

Con("Raster_1" == "Raster_2","Raster_1",0)

0 Kudos
1 Solution

Accepted Solutions
AmericaZelada
New Contributor II

Hi Dan, 

Thanks for your reply, 

I used raster calculator with this statement and it worked.

Con("Raster_1" == "Raster_2","Raster_1",0)

Best regards,

Ame

View solution in original post

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

An overview of the Conditional math toolset—Help | ArcGIS Desktop 

provides several tools for condition checking.  They can be used in combination if needed

You can use the

Set Null—Help | ArcGIS Desktop 

Setting values to NoData with Set Null—Help | ArcGIS Desktop 

The examples should help. 

You might want to look at the 

Conditional evaluation with Con—Help | ArcGIS Desktop 

AmericaZelada
New Contributor II

Hi Dan, 

Thanks for your reply, 

I used raster calculator with this statement and it worked.

Con("Raster_1" == "Raster_2","Raster_1",0)

Best regards,

Ame

0 Kudos
DanPatterson_Retired
MVP Emeritus

Good... There are a lot of similar answers on geonet that can be found once the key terms are known.

0 Kudos