Classify Raster (Image Analyst)

Available with Spatial Analyst license.

Available with Image Analyst license.

Summary

Classifies a raster dataset based on an Esri classifier definition file (.ecd) 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 must match the inputs used to generate the required .ecd file.

The .ecd file can be generated from any of the classifier training tools, such as Train Random Trees Classifier or Train Support Vector Machine Classifier.

Usage

  • The input raster can be any Esri-supported raster and any valid bit depth.

  • The input .ecd file contains attribute statistics suitable for the appropriate classifier.

  • To classify a time series of raster data using the Continuous Change Detection and Classification (CCDC) method, run the Analyze Changes Using CCDC tool to generate a change analysis raster. Use the change analysis raster and training sample data in the classifier training tools, and provide the resulting .ecd file and the change analysis raster as inputs to the Classify Raster tool.

    The output raster must be a .crf file to support a multidimensional output.

Syntax

ClassifyRaster(in_raster, in_classifier_definition, {in_additional_raster})
ParameterExplanationData Type
in_raster

The raster dataset to classify.

Mosaic Layer; Raster Layer; Image Service; String; Raster Dataset; Mosaic Dataset
in_classifier_definition

The input Esri classifier definition file (.ecd) containing the statistics for the chosen attributes for the classifier.

File
in_additional_raster
(Optional)

Ancillary raster datasets, such as a multispectral image or a DEM, are incorporated to generate attributes and other required information for the classifier. This raster will be necessary when calculating attributes such as mean or standard deviation. This parameter is optional.

Mosaic Layer; Raster Layer; Image Service; String; Raster Dataset; Mosaic Dataset

Return Value

NameExplanationData 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.ia import *

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

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.ia 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 Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")

# Execute 
classifiedraster = ClassifyRaster(insegras, indef_file, in_additional_raster)

#save output
classifiedraster.save("c:/test/moncton_classified.tif")
ClassifyRaster example 3 (stand-alone script)

This example classifies a time series multidimensional raster.

# Import system modules
import arcpy
from arcpy.ia import *

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


# Define input parameters
in_changeAnalysisRaster = "c:/test/LandsatCCDC.crf"
in_definition = "c:/output/change_detection.ecd"
in_additional_raster = ''

# Execute 
classifiedraster = arcpy.ia.ClassifyRaster(
	in_changeAnalysisRaster, indef_file, in_additional_raster)

#save output
classifiedraster.save("c:/test/time_series_class.crf")

Licensing information

  • Basic: Requires Image Analyst or Spatial Analyst
  • Standard: Requires Image Analyst or Spatial Analyst
  • Advanced: Requires Image Analyst or Spatial Analyst

Related topics