ST_SimplifyVW
Signature
GEOMETRY ST_SimplifyVW(GEOMETRY geom, DOUBLE distance);
Description
Simplifies geom using the Visvalingam-Whyatt algorithm with a distance tolerance (distance).
Ensures that resulting polygonal geometries are valid.
Note
The Visvalingam-Whyatt algorithm does not preserve topology.
To preserve the topology, use ST_SimplifyPreserveTopology.
But note that ST_SimplifyVW is significantly faster.
Examples
With LINESTRING
SELECT ST_SimplifyVW('LINESTRING(1 1, 3 2, 1 2, 2 3, 1 4, 4 3, 4 1)', 1.5);
-- Answer: LINESTRING (1 1, 2 3, 4 3, 4 1)

SELECT ST_SimplifyVW('LINESTRING(1 1, 3 2, 1 2, 2 3, 1 4, 4 3, 4 1)', 2);
-- Answer: LINESTRING (1 1, 4 3, 4 1)

With POLYGON
SELECT ST_SimplifyVW('POLYGON((2 1, 1 2, 2 2, 2 3, 3 3, 3 2, 4 2, 4 1, 3 0, 2 0, 2 1))', 0.5);
-- Answer: POLYGON ((2 1, 2 3, 4 2, 3 0, 2 1))

With MULTIPOLYGON
SELECT ST_SimplifyVW('MULTIPOLYGON(((2 1, 1 2, 2 2, 2 3, 3 3, 3 2, 4 2, 4 1, 3 0, 2 0, 2 1)),
((1 3, 0 4, 3 4, 1 3.5, 1 3)))', 0.5);
-- Answer: MULTIPOLYGON (((2 1, 2 3, 4 2, 3 0, 2 1)), ((1 3, 0 4, 3 4, 1 3)))

With a large distance
If the distance tolerance is too large (compared to the geometry), the Geometry may be oversimplified:
SELECT ST_SimplifyVW('POLYGON((2 1, 1 2, 2 2, 2 3, 3 3, 3 2, 4 2, 4 1, 3 0, 2 0, 2 1))', 2);
-- Answer: GEOMETRYCOLLECTION EMPTY
With (MULTI)POINT
POINTs and MULTIPOINTs cannot be further simplified:
SELECT ST_SimplifyVW('POINT(190 300)', 1);
-- Answer: Error