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
e = ENVI()
File = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
SUBDIRECTORY=['data'])
Raster = e.OpenRaster(File)
VectorFile = Filepath('qb_boulder_msi_vectors.shp', $
ROOT_DIR=e.Root_Dir, SUBDIRECTORY=['data'])
Vector = e.OpenVector(VectorFile)
Task = ENVITask('SmoothVector')
Task.INPUT_VECTOR = Vector
Task.SMOOTH_FACTOR = 14.0
Task.Execute
e.Data.Add, Task.OUTPUT_VECTOR
View = e.GetView()
Layer1 = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(Vector)
Layer3 = View.CreateLayer(Task.OUTPUT_VECTOR)
Syntax
Result = ENVITask('SmoothVector')
Input parameters (Set, Get): INPUT_VECTOR, MAXIMUM_VALUE, MINIMUM_VALUE, OUTPUT_VECTOR_URI, SMOOTH_FACTOR, UNITS
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
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 parameter.
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 parameter.
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.
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.6 |
Introduced |
ENVI 5.6.1 |
Added UNITS parameter
|
See Also
ENVITask, FilterVector Task, VectorRecordsToBoundingBox Task, VectorRecordsToCentroid Task, ReprojectVector Task