Arcgis 10 Raster Calculator Range

12636
5
06-20-2011 10:23 AM
DeviyaniGurung
New Contributor
Hello,

this is a very simple question, but for some reason the new syntax in the raster calculator in arcgis 10 is confusing me. I would just like to extract a range and export it into a new raster.

In 9.3.1, I just did 23<=[dem]<=25. This doesn't work in arc10, I tried doing ("dem"=>23) & ("dem"<=25) but I end of getting the entire raster.

any ideas?

thanks
0 Kudos
5 Replies
EricRice
Esri Regular Contributor
Greetings,

In many cases you have to tell the software what to do if the statement is true.  You can consider using a conditional statement in this case if you want the output raster to have the same values as the input, but just be a subset of the full data range.  The statement below worked well for me.

output =Con(("Raster.tif" >= 500) & ("Raster.tif" <= 2000),"Raster.tif")

If you want the true statement to be 1 and false to be 0, and not worry about maintaining the real input values you can just use this:

output = ("Raster.tif" >= 500) & ("Raster.tif" <= 2000)

Regards,
Eric
0 Kudos
JaredHowland1
New Contributor
So I am trying to do exactly as described in this thread. I need to extract a range of raster values being .2 or greater and less than .4.

I am using 10.1 and I am using your code. Here is the example, this is exaclty how I put it in raster calculator.
("Compare.tif" >= .2) & ("Compare.tif" <= 3.99) and I keep getting errors as shown in the attachement.

Please let me know what I'm doing wrong.

Thanks!

Jared
0 Kudos
DevlynRobson
New Contributor II
Hi

I have been having a similar problem trying to select ranges between 157 and 203 in 10. I tried the combinations listed above either got an error message or all pixels selected. I was going for a 0/1 answer.

Finally got it by using the following:
("aspect" > 157) * ("aspect" < 203)

Definably not the same way I used to do this is version 9!

Good luck!
0 Kudos
KailaiZhang
New Contributor II
Hi Jared,

Please check to see if you have any other version of python installed on the computer. By default, the site packages for 10.1 should be installed under C:\Python27\ArcGIS10.1\Lib\Site-packages, see if you have a site-packages folder directly under C:\Python27\lib or something like that and there is no numpy within it. That could cause ArcMap starts python directly from C:\Python27\lib, and it gives an error about no numpy module found.

Regards,
Kailai
0 Kudos
JaredHowland1
New Contributor
Thanks all for you replies!

I am getting numpy errors.

I did check the file path that you mentioned and I found a "numpy" folder. C:\Python27\ArcGIS10.1\Lib\site-packages\numpy.

What was it I'm supposed to do with this folder?

Thanks,

Jared
0 Kudos