Name

ST_CoverageInvalidEdges — Fonction window qui trouve les endroits où les polygones ne forment pas une couverture valide.

Synopsis

geometry ST_CoverageInvalidEdges(geometry winset geom, float8 tolerance = 0);

Description

A window function which checks if the polygons in the window partition form a valid polygonal coverage. It returns linear indicators showing the location of invalid edges (if any) in each polygon.

A set of valid polygons is a valid coverage if the following conditions hold:

  • Non-overlapping - les polygones ne se chevauchent pas (leurs intérieurs ne s'intersectent pas).

  • Edge-Matched - les sommets situés le long d'arêtes communes sont identiques.

As a window function a value is returned for every input polygon. For polygons which violate one or more of the validity conditions the return value is a MULTILINESTRING containing the problematic edges. Coverage-valid polygons return the value NULL. Non-polygonal or empty geometries also produce NULL values.

Les conditions permettent à une couverture valide de contenir des trous (espaces entre les polygones), pour autant que les polygones environnants soient adaptés aux bords. Toutefois, des espaces très étroits ne sont souvent pas souhaitables. Si le paramètre tolérance est spécifié avec une distance non nulle, les arêtes formant des espaces plus étroits seront également renvoyées comme non valides.

The polygons being checked for coverage validity must also be valid geometries. This can be checked with ST_IsValid.

Availability: 3.4.0

Requires GEOS >= 3.12.0

Exemples

Invalid edges caused by overlap and non-matching vertices

WITH coverage(id, geom) AS (VALUES
  (1, 'POLYGON ((10 190, 30 160, 40 110, 100 70, 120 10, 10 10, 10 190))'::geometry),
  (2, 'POLYGON ((100 190, 10 190, 30 160, 40 110, 50 80, 74 110.5, 100 130, 140 120, 140 160, 100 190))'::geometry),
  (3, 'POLYGON ((140 190, 190 190, 190 80, 140 80, 140 190))'::geometry),
  (4, 'POLYGON ((180 40, 120 10, 100 70, 140 80, 190 80, 180 40))'::geometry)
)
SELECT id, ST_AsText(ST_CoverageInvalidEdges(geom) OVER ())
  FROM coverage;

 id |               st_astext
----+---------------------------------------
  1 | LINESTRING (40 110, 100 70)
  2 | MULTILINESTRING ((100 130, 140 120, 140 160, 100 190), (40 110, 50 80, 74 110.5))
  3 | LINESTRING (140 80, 140 190)
  3 | null
      
-- Test entire table for coverage validity
SELECT true = ALL (
    SELECT ST_CoverageInvalidEdges(geom) OVER () IS NULL
    FROM coverage
    );
      

Voir aussi

ST_IsValid, ST_CoverageUnion, ST_CoverageSimplify