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 properties (Set, Get): APPLY_SYMBOLOGY, EXPORT_CLASSES, INPUT_RASTER, OUTPUT_METHOD, OUTPUT_VECTOR_URI
Output properties (Get only): OUTPUT_VECTOR
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
Methods
This task inherits the following methods from ENVITask:
Properties
This task inherits the following properties from ENVITask:
This task also contains the following properties:
APPLY_SYMBOLOGY (optional)
Set this property 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:
Single Vector Layer
(default): If you specify this option, provide a single filename for OUTPUT_VECTOR.One Vector Layer per Class
: If you specify this option, the output filenames will be<output filename>_<class name>.shp
, one for each class.
OUTPUT_VECTOR
This is a reference to the output vector.
OUTPUT_VECTOR_URI (optional)
Specify a string with the fully-qualified path and filename for OUTPUT_VECTOR.
Version History
ENVI 5.2 |
Introduced |
ENVI 5.5. 2 |
Deprecated EXPORT_AREA and EXPORT_CLASS_CLRS properties. Added APPLY_SYMBOLOGY and OUTPUT_METHOD properties. |
API Version
4.2
See Also
ENVITask, VectorRecordsToROI Task, ClassificationToPixelROI Task, ClassificationToPolygonROI Task