Skip to content

ST_Intersection

Compute the intersection of two geometries or geographies.

Usage

geometry ST_Intersection(geomA: geometry, geomB: geometry)
geography ST_Intersection(geogA: geography, geogB: geography)

Arguments

  • geogA (geography): Input geography
  • geogB (geography): Input geography
  • geomA (geometry): Input geometry
  • geomB (geometry): Input geometry

Examples

SELECT ST_Intersection(
    ST_GeomFromText('POLYGON ((1 1, 11 1, 11 11, 1 11, 1 1))'),
    ST_GeomFromText('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))')
) AS val;
┌────────────────────────────────────┐
│                 val                │
│              geometry              │
╞════════════════════════════════════╡
│ POLYGON((1 1,1 10,10 10,10 1,1 1)) │
└────────────────────────────────────┘