Sets the effective area for each vertex of a geometry object using the Visvalingam-Whyatt algorithm. The computed effective area is stored as the M value of each vertex.
Syntax
geometry ST_SetEffectiveArea(geometry geomA, float threshold, integer setArea);Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
geomA | geometry | — | The geometry object to process. |
threshold | float | 0 | The minimum effective area threshold. Only vertices with an effective area greater than or equal to this value are returned. Set to 0 to return all vertices. |
setArea | integer | 1 | Default value: 1. |
Usage notes
With `threshold`: filters vertices by effective area, enabling server-side simplification.
Without `threshold`: this function can be used to simplify geometry objects.
Simplification applies only to MultiLine, MultiPolygon, and MultiPoint objects. The function accepts any geometry type, but simplification is only performed on those three types.
For GeometryCollection objects, simplification is applied to each member geometry individually.
The returned geometry may have invalid or non-simple topology.
The returned geometry may lose M values from the input.
3D input geometry is supported. The 3D dimension of the input affects the output geometry.
The returned geometry may not preserve the topological validity or simplicity of the input.
Examples
The following example uses default parameter settings.
SELECT ST_AsText(ST_SetEffectiveArea('LINESTRING(0 0,1 1,2 2 )'::geometry));Result:
st_astext
------------------------------------------------------
LINESTRING M (0 0 3.40282e+38,1 1 0,2 2 3.40282e+38)
(1 row)