Name

ST_SetEffectiveArea — Sets for each vertex point it's effective area, and can by filtring on this area return a simplified geometry

Synopsis

geometry ST_SetEffectiveArea(geometry geomA, float threashold = 0, integer set_area = 1);

Description

Sets for each vertex point it's effective area from Visvalingam-Whyatt’s algorithm. The effective area is stored as the M-value of the geomtries. If the second optional parameter is used, the resulting geometriy will be build only on vertex points with an effective area greater than or equal to that threashold value. That will be a simplified geometry.

This function can be used for server side simplification by using the threashold. Another option is to not give any threashold value. Then you get the full geometry back, but with effective areas as M-values wich can be used by the client to simplify very fast.

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]

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

[Note]

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

[Note]

The output geoemtry will loose all previous information in the M-values

[Note]

This function handles 3D and the third dimmension will affect the effective area

Availability: 2.2.0

Examples

A linestring that get the efffective area calculated. All points is returned since we give 0 as themin area threashold


select ST_AStext(ST_SetEffectiveArea(geom)) all_pts, ST_AStext(ST_SetEffectiveArea(geom,30) ) thrshld_30
FROM (SELECT  'LINESTRING(5 2, 3 8, 6 20, 7 25, 10 10)'::geometry geom) As foo; 
-result
 all_pts | thrshld_30
-----------+-------------------+
LINESTRING M (5 2 3.40282346638529e+38,3 8 29,6 20 1.5,7 25 49.5,10 10 3.40282346638529e+38) | LINESTRING M (5 2 3.40282346638529e+38,7 25 49.5,10 10 3.40282346638529e+38)

				

See Also

ST_SimplifyVW