ClassificationToShapefile Task

This task exports one or more classes to a single shapefile. The vectors include separate records for each polygon.

Example

; Start the application

e = ENVI()

 

; Open an input file

File = Filepath('qb_boulder_msi', Subdir=['data'], $

  Root_Dir=e.Root_Dir)

Raster = e.OpenRaster(File)

 

; Create a classification ENVIRaster

ClassTask = ENVITask('ISODATAClassification')

ClassTask.INPUT_RASTER = Raster

ClassTask.Execute

 

; Run the smoothing task

SmoothTask = ENVITask('ClassificationSmoothing')

SmoothTask.INPUT_RASTER = ClassTask.OUTPUT_RASTER

SmoothTask.Execute

 

; Run the aggregation task

AggregationTask = ENVITask('ClassificationAggregation')

AggregationTask.INPUT_RASTER = SmoothTask.OUTPUT_RASTER

AggregationTask.Execute

 

; Convert the classes to shapefiles

ClassToVectorTask = ENVITask('ClassificationToShapefile')

ClassToVectorTask.INPUT_RASTER = AggregationTask.OUTPUT_RASTER

ClassToVectorTask.Execute

 

; Get the collection of data objects currently available in the Data Manager

DataColl = e.Data

 

; Add the output to the Data Manager

DataColl.Add, AggregationTask.OUTPUT_RASTER

DataColl.Add, ClassToVectorTask.OUTPUT_VECTOR

 

; Display the result

View = e.GetView()

Layer1 = View.CreateLayer(AggregationTask.OUTPUT_RASTER)

Layer2 = View.CreateLayer(ClassToVectorTask.OUTPUT_VECTOR)

Syntax

Result = ENVITask('ClassificationToShapefile')

Input parameters (Set, Get): APPLY_SYMBOLOGY, EXPORT_CLASSES, INPUT_RASTER, OUTPUT_METHOD, OUTPUT_VECTOR_URI

Output parameters (Get only): OUTPUT_VECTOR

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters

APPLY_SYMBOLOGY (optional)

Set this parameter if you want to generate a vector style sheet that will automatically set the colors of the output polygons to match the class colors of the input raster.

EXPORT_CLASSES (optional)

Specify a string array with class names to export to the shapefile.

INPUT_RASTER (required)

Specify a classification raster from which to generate a shapefile.

OUTPUT_METHOD (optional)

Specify a string indicating whether the output is a single vector layer with all classes, or one vector layer per class. The choices are:

OUTPUT_VECTOR_URI (optional)

Specify a string with the fully qualified path and filename for OUTPUT_VECTOR.

Output Parameters

OUTPUT_VECTOR

This is a reference to the output vector.

Methods

Execute

Parameter

ParameterNames

Properties

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History

ENVI 5.2

Introduced

ENVI 5.5.2

Deprecated EXPORT_AREA and EXPORT_CLASS_CLRS parameters. Added APPLY_SYMBOLOGY and OUTPUT_METHOD parameters.

See Also

ENVITask, VectorRecordsToROI Task, ClassificationToPixelROI Task, ClassificationToPolygonROI Task