Skip to content

ST_Intersection_Agg

Returns the cumulative intersection of all geometries in the input.

Usage

geometry ST_Intersection_Agg(geom: geometry)

Arguments

  • geom (geometry): Input geometry

Examples

SELECT ST_Intersection_Agg(geom) FROM (
  VALUES
    (ST_GeomFromText('POLYGON ((0 0, 0 4, 4 4, 4 0, 0 0))')),
    (ST_GeomFromText('POLYGON ((2 2, 2 6, 6 6, 6 2, 2 2))'))
) AS t(geom);
┌───────────────────────────────────────┐
│      st_intersection_agg(t.geom)      │
│                geometry               │
╞═══════════════════════════════════════╡
│ MULTIPOLYGON(((2 4,2 2,4 2,4 4,2 4))) │
└───────────────────────────────────────┘