Skip to content
🎉 Apache Sedona 1.8.1 is now available! Check out the new features and improvements.

ST_Intersection_Agg

Introduction: Return the polygon intersection of all polygons in A

Format: ST_Intersection_Agg (A:geometryColumn)

Note

This function was previously named ST_Intersection_Aggr, which is deprecated since v1.8.1.

SQL example:

WITH src_tbl AS (
    SELECT sedona.ST_GeomFromText('POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))') AS geom
    UNION
    SELECT sedona.ST_GeomFromText('POLYGON ((0.5 0.5, 0.5 1.5, 1.5 1.5, 1.5 0.5, 0.5 0.5))') AS geom
)
SELECT sedona.ST_AsText(intersected)
FROM src_tbl,
     TABLE(sedona.ST_Intersection_Agg(src_tbl.geom) OVER (PARTITION BY 1));

Output:

POLYGON ((0.5 1, 1 1, 1 0.5, 0.5 0.5, 0.5 1))