Skip to main content

simplify

Computes a simplified representation of a geometry using the Douglas-Peucker algorithm.

Simplification reduces the number of vertices by removing those which are within the tolerance distance of the simplified linework.

The simplification tolerance is in input geometry units.

Parameters

NameTypeDefaultDescription
geometryGeometryThe geometry to simplify
tolerancenumberThe maximum allowed deviation - any vertex within this distance of the simplified linework is removed
options?objectOptional options object
options.preserveTopology?booleantrueWhether to preserve the original topology during simplification.
When true, a topology‐preserving variant of the Douglas–Peucker algorithm is used. The output will be valid and simple if the input is. This option is computationally more expensive.
When false, the standard Douglas–Peucker simplification is used, which may produce invalid or self‐intersecting geometries.

Returns

Geometry

A new, simplified, geometry without "unnecessary" vertices

Throws

Examples