Name

ST_Intersection — Returns a 2D geometric object that represents the intersection of two geometric objects.

Synopsis

geometry ST_Intersection(bytea GeomA, bytea GeomB);

Alias

Intersection

Description

Returns a geometric object that represents the intersection of two geometric objects.

[Note]

GeometryCollections are unsupported.

Coordinate Dimensions
2D3DM

-

-

Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
2.1.1.37.2.21.17.2.8.15.1.18

Examples

--2D Geometries
SELECT ST_astext(ST_Intersection (
st_geomfromtext('POLYGON ((1 3, 1 8, 6 8, 6 3, 1 3))') ,
st_geomfromtext('MULTIPOLYGON (((6 8, 6 10, 8 10, 8 8, 6 8)),((6 3, 6 6, 10 6, 10 3, 6 3)))')));

--Result
GEOMETRYCOLLECTION (POINT (6 8), LINESTRING (6 6, 6 3))

--3D Geometries
SELECT ST_astext(ST_Intersection (
st_geomfromtext('POLYGON ((1 3 2, 1 8 4, 6 8 6, 6 3 4, 1 3 2))') , 
st_geomfromtext('LINESTRING (4 2 3, 2 4 5, 4 9 6, 4 10 7)')));

--Result
LINESTRING (3 3, 2 4, 3.6 8)
Geom A, GeomB
ST_Intersection (GeomA,GeomB)
Geom A, GeomB
ST_Intersection (GeomA,GeomB)

Related functions

ST_Intersects,ST_Difference,ST_SymDifference