Reclassify (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Reclassifies (or changes) the values in a raster.

Usage

Syntax

Reclassify (in_raster, reclass_field, remap, {missing_values})
ParameterExplanationData Type
in_raster

The input raster to be reclassified.

Raster Layer
reclass_field

Field denoting the values that will be reclassified.

Field
remap

The Remap object is used to specify how to reclassify values of the input raster.

There are two ways to define how the values will be reclassified in the output raster: RemapRange and RemapValue. Either ranges of input values can be assigned to a new output value, or individual values can be assigned to a new output value.

The following are the forms of the remap objects.

  • RemapRange (remapTable)
  • RemapValue (remapTable)
Remap
missing_values
(Optional)

Denotes whether missing values in the reclass table retain their value or get mapped to NoData.

  • DATASignifies that if any cell location on the input raster contains a value that is not present or reclassed in a remap table, the value should remain intact and be written for that location to the output raster. This is the default.
  • NODATA Signifies that if any cell location on the input raster contains a value that is not present or reclassed in a remap table, the value will be reclassed to NoData for that location on the output raster.
Boolean

Return Value

NameExplanationData Type
out_raster

The output reclassified raster.

The output will always be of integer type.

Raster

Code Sample

Reclassify example 1 (Python window)

The following examples show several ways of reclassifying a raster.

import arcpy
from arcpy import env  
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"

outReclass1 = Reclassify("landuse", "Value", 
                         RemapValue([[1,9],[2,8],[3,1],[4,6],[5,3],[6,3],[7,1]]))
outReclass1.save("C:/sapyexamples/output/landuse_rcls")

outReclass2 = Reclassify("slope_grd", "Value", 
                         RemapRange([[0,10,"NODATA"],[10,20,1],[20,30,2],
                                     [30,40,3],[40,50,4],[50,60,5],[60,75,6]]))
outReclass2.save("C:/sapyexamples/output/slope_rcls")

outReclass3 = Reclassify("pop_density", "Value", 
                         RemapRange([[10,10,1],[10,20,2],[20,25,3],
                                     [25,50,4],[50,]]), "NODATA")
outReclass3.save("C:/sapyexamples/output/popden_rcls")
Reclassify example 2 (stand-alone script)

This example reclassifies the input raster based on the values in a string field.

# Name: reclassify_example02.py
# Description: Reclassifies the values in a raster.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "landuse"
reclassField = "LANDUSE"
remap = RemapValue([["Brush/transitional", 0], ["Water", 1],["Barren land", 2]])

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute Reclassify
outReclassify = Reclassify(inRaster, reclassField, remap, "NODATA")

# Save the output 
outReclassify.save("C:/sapyexamples/output/outreclass02")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst or 3D Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst or 3D Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst or 3D Analyst
4/10/2014