Select to view content in your preferred language

Extracting raster values according to different classes

7193
15
Jump to solution
07-01-2015 12:39 PM
DitlevReventlow
Deactivated User

Hey everyone.

I have a raster dataset (bshl_112p_srf) that I want to split up according to the classes that I have defined.

These classes are defined as:

158-535

535,0000001-686

686,0000001-1473

I have tried to use raster calculator to do this but it doesn't work. To extract the first class I tried to type:

Con("bshl_112p_srf" <= 535,"bshl_112p_srf")

, however I get an error for this expression.

What do I do wrong? Also, how would you extract the middle class (where you both need to have a <= and >= ). 

Would it be something like:

Con("bshl_112p_srf" >= 535,0000001 & <=686,"bshl_112p_srf")

Thank you!

best regards

Ditlev Reventlow

0 Kudos
15 Replies
JayantaPoddar
MVP Alum

An additional parenthesis when using &.

like

Class 1 =  Con(("bshl_112p_srf" >= 158) & ("bshl_112p_srf" <= 535), "bshl_112p_srf")

Class 2 = Con(("bshl_112p_srf" > 535) & ("bshl_112p_srf" <= 686), "bshl_112p_srf")

Class 3 = Con(("bshl_112p_srf" > 686) & ("bshl_112p_srf" <= 1473), "bshl_112p_srf")

Hope this will work



Think Location
DitlevReventlow
Deactivated User

It works, thank you so much!!! Very gratefull!

0 Kudos
DanPatterson_Retired
MVP Emeritus

For your immediate concern... you should not be working in folders that contain a space...

In the future, you might want to look at Extract by Attributes—Help | ArcGIS for Desktop

​since you have the spatial analyst.  This will produce simpler approach and can be easily be put in a loop

DitlevReventlow
Deactivated User

Okay I have done all my modelling working in this folder. What could the effects of it be?

0 Kudos
IanMurray
Honored Contributor

I see nothing wrong with your first statement, works fine for me.

Your middle class would need to be

Con("bshl_112p_srf" >= 535,0000001 & "bshl_112p_srf" <=686,"bshl_112p_srf").

Are you wanting to split them into three seperate rasters or truly make a new raster with 3 classes in it for each range with the same value?  If so you might want to check out the Reclassify Tool.

ArcGIS Desktop

DitlevReventlow
Deactivated User

Thanks for mentioning the reclassify tool. I had not tried to use it yet. I don't think I need it in this case though. It is probably more usefull for me to have 3 individual rasters.

0 Kudos