This topic describes the ST_Simplify function. This function returns a geometry object representing a simplified version of the input geometry object. This function uses the Douglas-Peucker algorithm.
geometry ST_Simplify(geometry geomA , float tolerance , boolean preserveCollapsed);
|The geometry object that you want to specify.
|The tolerance that you want to specify.
|The flag that specifies whether to keep small geometry objects in the returned geometry object.
- This function supports simplification operations only on MultiLine objects, MultiPolygon objects, and MultiPoint objects. However, you can use this function to process any geometry objects.
- The simplification operation is performed on the input geometry objects one by one. Therefore, you can use this function to process GeometryCollection objects.
- If the scale of the input geometry object is much smaller than the value of the tolerance
parameter and the preserveCollapsed parameter is specified, the input geometry object
does not disappear.
The preserveCollapsed parameter is useful to render engines to prevent a large number of small geometry objects from disappearing from maps and leaving abnormal gaps.
- The returned geometry object may lose its simplicity.
- This function may change the topology of the input geometry object and return an invalid
You can use the ST_SimplifyPreserveTopology function to preserve the topology of the input geometry object.
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;