SmoothVector Task

This task uses the Douglas-Peucker smoothing algorithm to reduce the number of vertices in each input record of a polyline or polygon vector. The output is a new shapefile.

Note: The smoothing algorithm will not preserve the original vector topology. It will only simplify the geometry of each record without regard for adjacent records or relationships. All record attributes will be preserved without change.

Reference: Douglas, D. and T. Peucker. "Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or its Caricature." The Canadian Cartographer 10, No. 2 (1973): 112-122.

Example

; Start the application

e = ENVI()

 

; Open an input raster

File = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $

SUBDIRECTORY=['data'])

Raster = e.OpenRaster(File)

 

; Open an input vector

VectorFile = Filepath('qb_boulder_msi_vectors.shp', $

ROOT_DIR=e.Root_Dir, SUBDIRECTORY=['data'])

Vector = e.OpenVector(VectorFile)

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('SmoothVector')

 

; Select task inputs

Task.INPUT_VECTOR = Vector

Task.SMOOTH_FACTOR = 14.0

 

; Run the task

Task.Execute

 

; Add the output to the Data Manager

e.Data.Add, Task.OUTPUT_VECTOR

 

; Display the resulting vector

; over the raster layer

View = e.GetView()

Layer1 = View.CreateLayer(Raster)

Layer2 = View.CreateLayer(Vector)

Layer3 = View.CreateLayer(Task.OUTPUT_VECTOR)

Syntax

Result = ENVITask('SmoothVector')

Input properties (Set, Get): INPUT_VECTOR, MAXIMUM_VALUE, MINIMUM_VALUE, OUTPUT_VECTOR_URI, SMOOTH_FACTOR, UNITS

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:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties

This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

INPUT_VECTOR (required)

Specify an input polyline or polygon ENVIVector.

MAXIMUM_VALUE (optional)

Specify the maximum area (for polygons) or length (for polylines) to consider. Values greater than the maximum will be discarded in the output shapefile. The units depend on the coordinate system of the input vector. The units depend on the coordinate system of the input vector; however, you can override these units by specifying the UNITS property.

MINIMUM_VALUE (optional)

Specify the minimum area (for polygons) or length (for polylines) to consider. Values less than the minimum will be discarded in the output shapefile. The units depend on the coordinate system of the input vector; however, you can override these units by specifying the UNITS property.

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.

SMOOTH_FACTOR (required)

Specify a floating-point value with the distance smoothing factor to use. This is the epsilon value in the Douglas-Peucker algorithm. All vertices within the specified distance will be compressed down to a single vertex. The units of the smoothing factor are the same as those of the vector vertices.

UNITS (optional)

Specify a string with the units of the minimum and maximum values. The choices are Meters, Kilometers, Feet, US Survey Feet, Yards, Miles, and Nautical Miles.

If you do not specify UNITS, be sure to specify the MINIMUM_VALUE and MAXIMUM_VALUE in the same units of the INPUT_VECTOR.

Version History

ENVI 5.6

Introduced

ENVI 5.6.1

Added UNITS property

API Version

4.2

See Also

ENVITask, FilterVector Task, VectorRecordsToBoundingBox Task, VectorRecordsToCentroid Task, ReprojectVector Task