Returns a simplified version of the input geometry object using the Douglas-Peucker algorithm.
Syntax
geometry ST_Simplify(geometry geomA, float tolerance, boolean preserveCollapsed);Parameters
| Parameter | Description |
|---|---|
geomA | The geometry object to simplify. |
tolerance | The simplification tolerance. Higher values produce more aggressive simplification. |
preserveCollapsed | Specifies whether to retain small geometry objects that would otherwise collapse below the tolerance threshold. |
Usage notes
Simplification operates natively on MultiLineString, MultiPolygon, and MultiPoint objects. The function accepts any geometry type and processes GeometryCollection objects element by element.
When the scale of a geometry object is much smaller than the
tolerancevalue, the object collapses and disappears from the result—unlesspreserveCollapsedis set totrue. This is useful for render engines that need to prevent small geometry objects from leaving gaps on maps.The returned geometry may lose its simplicity.
This function may alter the topology of the input geometry and return an invalid geometry object. To preserve topology, use ST_SimplifyPreserveTopology instead.
Examples
The following example applies ST_Simplify to a LineString with two different tolerance values (0.25 and 0.5) to show how increasing tolerance reduces vertex count.
select g, ST_Simplify(g, 0.25),
ST_Simplify(g, 0.5)
from (select 'LINESTRING(0 0,2 2,3 1,3.5 1.5,5 0,5.25 0.25,5.5 0)'::geometry as g) as t;

