Available with Spatial Analyst license.
Summary
Classify a raster dataset based on an Esri Classifier Definition (.ecd) file and raster dataset inputs.
The .ecd file contains all the information needed to perform a specific type of Esri-supported classification. The inputs to this tool need to match the inputs used to generate the required .ecdfile.
Usage
The input raster can be any Esri-supported raster and can be any valid bit depth.
The input Esri classifier definition (.ecd) file contains attribute statistics suitable for the appropriate classifier.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
ClassifyRaster (in_raster, in_classifier_definition, {in_additional_raster})
Parameter | Explanation | Data Type |
in_raster | Select the raster dataset you want to classify. | Segmented Raster | Raster Dataset | Mosaic Dataset | Raster Layer | Mosaic Layer | Image Service Layer |
in_classifier_definition | The input Esri Classifier Definition (.ecd) file containing the statistics on the chosen attributes for the classifier. | File |
in_additional_raster (Optional) | Optionally incorporate ancillary raster datasets, such as a segmented image, a multispectral image, or a DEM, to generate attributes and other required information for the classifier. The raster datasets for this parameter must match those used to create the training .ecd file. | Segmented Raster | Raster Dataset | Mosaic Dataset | Raster Layer | Mosaic Layer | Image Service Layer |
Return Value
Name | Explanation | Data Type |
out_raster_dataset | The path and name of the classified image you are creating. The output classified raster is defined by the input raster dataset and .ecd file inputs. | Raster |
Code Sample
ClassifyRaster example 1 (Python window)
This example classifies an input TIFF raster.
# Import system modules
import arcpy
from arcpy.sa import *
classifiedraster = ClassifyRaster("c:/classifydata/moncton_seg.tif",
"c:/classifydata/moncton_sig.ecd",
"c:/classifydata/moncton.tif")
classifiedraster.save("c:/test/moncton_classified.tif")
ClassifyRaster example 2 (stand-alone script)
This example classifies an input TIFF raster.
# Import system modules
import arcpy
from arcpy.sa import *
# Set local variables
insegras = "c:/classifydata/moncton_seg.tif"
indef_file = "c:/classifydata/moncton_sig.ecd"
in_additional_raster = "c:/classifydata/moncton.tif"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute
classifiedraster = ClassifyRaster(insegras, indef_file, in_additional_raster)
#save output
classifiedraster.save("c:/test/moncton_classified.tif")
Environments
Licensing Information
- ArcGIS for Desktop Basic: Requires Spatial Analyst
- ArcGIS for Desktop Standard: Requires Spatial Analyst
- ArcGIS for Desktop Advanced: Requires Spatial Analyst