How can I write the following conditional statement with CON?
If ((VALUE = 20 OR IF VALUE=24) then assign value 0, else 1)
Con(("Raster1", 0, 1, "VALUE =20")|("Raster1", 0, 1, "VALUE =24"),0,1)
I just can´t get this to work
Read about Raster Calculator operators. The bar "|" symbol is the OR operator.
The correct syntax would be:
Con(("Raster1" == 20) | ("Raster1" == 24), 0, 1)
con
at all?!(("Raster1"==20) | ("Raster1"==24))
should do it. You could even use alternatives likeabs("Raster1"-22)!=2
. Although that's a poor choice--it's harder to understand--it leads to a superior solution for floating point rasters, whose values might not exactly equal 20 or 24. You can now easily add a tolerance, such asabs(abs("Raster1"-22)-2)>0.00001
. That helps you avoid a nasty pitfall. (Note that the details of the syntax depend on what version of ArcGIS you are using.)