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
| Name | Type | Default | Description |
|---|---|---|---|
geometry | Geometry | The geometry to simplify | |
tolerance | number | The maximum allowed deviation - any vertex within this distance of the simplified linework is removed | |
options? | object | Optional options object | |
options.preserveTopology? | boolean | true | Whether 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