ST_Simplify — Returns a "simplified" version of the given geometry using the Douglas-Peucker algorithm.


geometry ST_Simplify(geometry geomA, float tolerance);


Returns a "simplified" version of the given geometry using the Douglas-Peucker algorithm. Will actually do something only with (multi)lines and (multi)polygons but you can safely call it with any kind of geometry. Since simplification occurs on a object-by-object basis you can also feed a GeometryCollection to this function.


Note that returned geometry might loose its simplicity (see ST_IsSimple)


Note topology may not be preserved and may result in invalid geometries. Use (see ST_SimplifyPreserveTopology) to preserve topology.

Performed by the GEOS module.

Availability: 1.2.2


Changed: 2.0.0 -- the behavior of this function changed to be more consistent. This made some people unhappy.


Changed: 2.0.2 -- the behavior of this function was changed back 1.5 behavior. This made people who liked the newer more consistent behavior unhappy resulting in long painful discussions. So will probably result in a change back to newer behavior.


A circle simplified too much becomes a triangle, medium an octagon,

SELECT ST_Npoints(the_geom) As np_before, ST_NPoints(ST_Simplify(the_geom,0.1)) As np01_notbadcircle, ST_NPoints(ST_Simplify(the_geom,0.5)) As np05_notquitecircle,
ST_NPoints(ST_Simplify(the_geom,1)) As np1_octagon, ST_NPoints(ST_Simplify(the_geom,10)) As np10_triangle,
(ST_Simplify(the_geom,100) is null) As  np100_geometrygoesaway
FROM (SELECT ST_Buffer('POINT(1 3)', 10,12) As the_geom) As foo;
 np_before | np01_notbadcircle | np05_notquitecircle | np1_octagon | np10_triangle | np100_geometrygoesaway
		49 |                33 |                  17 |           9 |             4 | t


See Also

ST_IsSimple, ST_SimplifyPreserveTopology