I have 12 raster on NDVI. I want to use if conditional statement. Something like this :

Con ("raster1"=="raster2"=="raster3"=="raster4"=="raster5"=="raster6"=="raster7"=="raster8"=="raster9"=="raster10"=="raster11"=="raster12","raster1",255)

In that statement, I use raster calculator. But, it is error. Does anyone know how to perform this in ArcGIS?

  • Can you explain the reasoning behind your conditional statement? What is it you wish to find out? It might be that there is a different way of approaching this. – JPD Dec 18 '13 at 12:25
  • 1
    I want to see that there are changes or not in each pixel. If there are no changes, so raster1=raster2...etc. And I want to see what pixel value that no changes. If there are changes, I want to give sign (for example I give value 255). Thanks. – mega Dec 19 '13 at 0:12

You cannot use a list of == in the same conditional test. You need to link them with logical expressions.

Con ( (raster1== raster2) & (raster2==raster3) & ...

  • Great. It is work. Ok, there is a little problem. There are clouds and the value is zero. I want zero value is out from counting. How to perform this? Thanks. – mega Dec 19 '13 at 8:38
  • same idea as before : ((raster1==raster2)|(raster1==0)|(raster2==0))&... – radouxju Dec 19 '13 at 8:47
  • I have tried for ((raster1==raster2)|(raster1==0)|(raster2==0))&... It is work, but it is not in order. I have tried for 6 raster. The value for raster1; raster2... are 0; 0; 0; 0.1; 0; 0.2. The result is 0. The result should 255. Because 0.1 is not the same as 0.2. Another value for raster1; raster2... are 0,2; 0,2; 0; 0,4; 0; 0,2. The result is 0,2. May be a little work to fix the this formula. Thanks. – mega Dec 20 '13 at 6:09
  • Largely, this formula is true when I see the value. But, when one of the raster value is zero, sometimes the result is wrong. Thanks. – mega Dec 20 '13 at 6:33
  • You need indeed to test all combination (n(n-1)/2, that is 66 with n=12) in order to have your final result. There is certainly a better algorithm, but this is another question. For instance, you iterate through your file rasterOld – radouxju Dec 20 '13 at 6:35

By the way, I try other tool, and I get the answer. There are two steps. First, I use Equal To Frequency. I input raster1 for value raster. Then I input other raster for raster1 until raster12. For example the output raster is raster13. The value will be 0 until 12 depends on value among raster. If the value is 12, so raster1=raster2=raster3...etc. The second step, I use Raster Calculator. That is : Con("raster13"==12,"raster1",255). I hope this is useful. Thanks.


You could just use cell statistics. Where all the values are the same the variety statistic will be 1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.