Simplify line or polygon

This uses the Douglas and Peucker (1973) algorithm to simplify vector line or polygon features. The tool requires the user to input the name of a vector shapefile of a polyline or polgon shape-type, a distance tolerance threshold parameter (measured in the file's x-y units). The user may also opt to ensure that no features are lost. Without this option, smaller features that have few nodes distanced closely together may be erased from the output shapefile. Note that in general the Douglas and Peucker (1973) algorithm does not preserve topology, i.e. polygons can be split, collapse to lines, holes can disappear or be created, and lines can cross. The tool uses the line simplification algorithm provided by the Java Topology Suite (JTS) library. Line simplification can be computationally intensive and time consuming for large and complex vector files.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
inputFile = wd + "lines.shp"
outputFile = wd + "output.shp"
distanceTolerance = "24.5"
ensureNoFeatureLost = "false"
args = [inputFile, outputFile, distanceTolerance, ensureNoFeatureLost]
pluginHost.runPlugin("SimplifyLineOrPolygon", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "polygons.shp"
def outputFile = wd + "output.shp"
def distanceTolerance = "24.5"
def ensureNoFeatureLost = "true"
String[] args = [inputFile, outputFile, distanceTolerance, ensureNoFeatureLost]
pluginHost.runPlugin("SimplifyLineOrPolygon", args, false)

Credits: