AnsweredAssumed Answered

Reclass with ArcPy

Question asked by kostas_ptr88 on Nov 15, 2015
Latest reply on Nov 15, 2015 by Dan_Patterson

Hi I am trying to bulid a python tool in which the user will import a DEM and that tool will reclassify it in 3 classes, for maxheight-10, maxheight-20 & maxheight-30 meters to use it for other process. I have created that code but I always get an error that RemapRange is not defined. Why is that? I am using ArcGIS 10.2.2

 

# Import system modules
import arcpy


# Set environment settings
inWorkspace = arcpy.GetParameterAsText(0)
inDEM = arcpy.GetParameterAsText(1)
outDEM = arcpy.GetParameterAsText(2)


# Get Raster Properties
maxvalue = arcpy.GetRasterProperties_management(inDEM, "MAXIMUM")
minvalue = arcpy.GetRasterProperties_management(inDEM, "MINIMUM")
minvalue2 = (minvalue.getOutput(0))
maxvalue2 = (maxvalue.getOutput(0))


# Conversion of max value to integer
intmaxvalue = int(float(maxvalue.getOutput(0)))


# Creation of classes per 10 meters until intmaxvalue-30 meters
class1 = intmaxvalue - 10
class2 = intmaxvalue - 20
class3 = intmaxvalue - 30


#Reclass DEM
reclassfield = "Value"
myRemapRange = RemapRange([[minvalue, class3, 4], [class3, class2, 3], [class2, class1, 2], [class1, maxvalue2, 1]])
outReclass = Reclassify(inDEM, reclassfield, myRemapRange)
outReclass.save(outDEM)

Outcomes