CG_PolygonRepair — Repair an invalid polygon or multipolygon.
geometry CG_PolygonRepair(geometry geom, text rule);
Repair an invalid polygon or multipolygon using CGAL's 2D Polygon Repair algorithm. Returns a MultiPolygon.
The rule parameter controls the repair strategy:
EVEN_ODD (default) — areas covered an odd number of times are kept. Available with CGAL 6.0+.
NON_ZERO — areas with non-zero winding number are kept. Requires CGAL 6.1+.
UNION — union of all input polygons. Requires CGAL 6.1+.
INTERSECTION — intersection of all input polygons. Requires CGAL 6.1+.
Availability: 3.7.0 - requires SFCGAL >= 2.3.0 and CGAL >= 6.0.
Diese Methode benötigt ein SFCGAL-Backend.
Diese Funktion unterstützt polyedrische Flächen.
-- Repair a bowtie (self-intersecting) polygon
SELECT ST_AsText(CG_PolygonRepair('POLYGON((0 0,2 2,2 0,0 2,0 0))'));
-- MULTIPOLYGON(((0 0,1 1,0 2,0 0)),((1 1,2 0,2 2,1 1)))
-- Keep all winding area with UNION rule (requires CGAL 6.1 or later)
SELECT ST_AsText(CG_PolygonRepair('POLYGON((0 0,2 2,2 0,0 2,0 0))', 'UNION'));
-- MULTIPOLYGON(((0 0,1 1,0 2,0 0)))