Select to view content in your preferred language

Only extract values that are the same in two raster dataset

5535
12
Jump to solution
06-11-2015 05:47 AM
DitlevReventlow
Deactivated User

Hey everyone.

I have two raster datasets with the same spatial resolution and extent. Both these datasets have values between 0 to 16.

How do I extract only the values that are the same in both datasets?

Thank you!

Best regards

Ditlev Reventlow

Tags (1)
0 Kudos
12 Replies
DitlevReventlow
Deactivated User

Dan,

Thank you for this. I don't want the "not-similar" data to be set to 0, I just want them not to be included in the output raster.Then I guess that it is fine to write:

Con("bsh_lu_2012_e" == "bsh_lu_2001_e","bsh_lu_2012_e")

Right? (just wanted to make sure because this is the statement I have used)

0 Kudos
curtvprice
MVP Alum

Yes, when you don't provide a "false expression" to Con, and the first argument resolves to false, the output cell value will be NoData.

0 Kudos
DanPatterson_Retired
MVP Emeritus

If you are doing this in the Raster Calculator explore your options

Con("x4" == "x2",5,"x4") F:\Test\x5... if x4 is equal to x2 give it a value of 5, otherwise keep x4's values

From the Results Window

Messages

Executing: RasterCalculator Con("x4" == "x2",5,"x4") F:\Test\x5

Start Time: Fri Jun 12 23:46:41 2015

Con(Raster(r"x4") == Raster(r"x2"),5,Raster(r"x4"))

Succeeded at Fri Jun 12 23:46:41 2015 (Elapsed Time: 0.11 seconds)

Note the addition of Raster around the input raster layer names

0 Kudos