Select to view content in your preferred language

Reclass slope

4239
4
Jump to solution
03-16-2015 05:19 AM
KONPETROV
Frequent Contributor

Hello i have a slope layer and i want to reclass it in to classes with python in arcpy window. I used this code:

import arcpy

from arcpy import env 

from arcpy.sa import *

# Set environment settings

env.workspace = "c:/suit/Sik"

# Set local variables

inRaster = "outSlope"

reclassField = "VALUE"

RclSlope = Reclassify("outSlope", "VALUE", RemapRange([[0,45,1],[45,87,2]]))

RclSlope.save("c:/suit/Sik/RclSlope")

but finally i get 3 classes[0-45 1st class, 45-87 2nd class, 87 3rd class] due to the reason that in the second class. 87 is not the maximum value of slope but 87,7 is. How can i write the code so as to take the maximum value of slope at the second class?

note: Slope is countable to degrees

Thanks a lot

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

Hi Kon,

You could replace the value of 87 with 88. Then the maximum value of 87.7 would be included in the second class itself.

Thanks,

Jay



Think Location

View solution in original post

4 Replies
JayantaPoddar
MVP Esteemed Contributor

Hi Kon,

You could replace the value of 87 with 88. Then the maximum value of 87.7 would be included in the second class itself.

Thanks,

Jay



Think Location
DarrenWiens2
MVP Honored Contributor

Or (lazy answer), replace the value to 91 - then you're guaranteed to include the maximum value of 90 degrees regardless of the actual maximum data value.

KONPETROV
Frequent Contributor

hahaha ok, it wasn't so complicated as i thought. Thanks a lot

0 Kudos
DanPatterson_Retired
MVP Emeritus

Just remember as well, that you can go into the symbology the layer and change the labels for the classes to represent what you want for example

real easy

No too bad

getting tired

grief!!! who picked this route

and not show the actual values at all