დასახელება

ST_SetEffectiveArea — Sets the effective area for each vertex, using the Visvalingam-Whyatt algorithm.

სინოპსისი

geometry ST_SetEffectiveArea(geometry geom, float threshold = 0, integer set_area = 1);

აღწერა

Sets the effective area for each vertex, using the Visvalingam-Whyatt algorithm. The effective area is stored as the M-value of the vertex. If the optional "threshold" parameter is used, a simplified geometry will be returned, containing only vertices with an effective area greater than or equal to the threshold value.

This function can be used for server-side simplification when a threshold is specified. Another option is to use a threshold value of zero. In this case, the full geometry will be returned with effective areas as M-values, which can be used by the client to simplify very quickly.

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 lose its simplicity (see ST_IsSimple)

[შენიშვნა]

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

[შენიშვნა]

The output geometry will lose all previous information in the M-values

[შენიშვნა]

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

Availability: 2.2.0

მაგალითები

Calculating the effective area of a LineString. Because we use a threshold value of zero, all vertices in the input geometry are returned.

Code
SELECT ST_SetEffectiveArea(geom) AS all_pts,
       ST_SetEffectiveArea(geom, 30) AS threshold_30
FROM (SELECT  'LINESTRING(5 2,3 8,6 20,7 25,10 10)'::geometry geom) As foo;
Output
-[ RECORD 1 ]------------------
all_pts      | LINESTRING M (5 2 3.4e+38,3 8 29,6 20 1.5,7 25 49.5,10 10 3.4e+38)
threshold_30 | LINESTRING M (5 2 3.4e+38,7 25 49.5,10 10 3.4e+38)
Figure
Geometry figure for visual-st-seteffectivearea-01

ასევე იხილეთ

ST_SimplifyVW