This topic describes the ST_SimplifyPreserveTopology function. This function returns a geometry object representing a simplified version of the input geometry object. This function uses the Douglas-Peucker algorithm. This function prevents the return of an invalid geometry object.
geometry ST_SimplifyPreserveTopology(geometry geomA , float tolerance);
|geomA||The geometry object that you want to specify.|
|tolerance||The tolerance that you want to specify.|
- 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.
- This function prevents the return of a derived and invalid geometry object, especially polygon objects.
SELECT ST_ASText(ST_SimplifyPreserveTopology(g,1)) as PreserveTopology ,ST_ASText(ST_Simplify(g,1)) as Normal from (select 'POLYGON((0 0,1 0,0 1,1 1,0 0))'::geometry as g) as t; preservetopology | normal ----------------------------+-------- POLYGON((0 0,1 0,1 1,0 0)) | (1 row)