ST_Intersection
Calculates the set of points shared by two GEOMETRY objects.
	Calculates the set of points shared by two GEOMETRY objects.
Behavior type
ImmutableSyntax
ST_Intersection( g1, g2 )
Arguments
- g1
- Spatial object, type GEOMETRY
- g2
- Spatial object, type GEOMETRY
Returns
GEOMETRY
Supported data types
| Data Type | GEOMETRY | 
|---|---|
| Point | Yes | 
| Multipoint | Yes | 
| Linestring | Yes | 
| Multilinestring | Yes | 
| Polygon | Yes | 
| Multipolygon | Yes | 
| GeometryCollection | Yes | 
Examples
The following examples show how to use ST_Intersection.
Two polygons intersect at a single point:

=> SELECT ST_AsText(ST_Intersection(ST_GeomFromText('POLYGON((0 2,1 1,0 -1,
   0 2))'),ST_GeomFromText('POLYGON((-1 2,0 0,-2 0,-1 2))')));
    ST_AsText
-----------------
 POINT(0 0)
(1 row)
Two polygons:

=> SELECT ST_AsText(ST_Intersection(ST_GeomFromText('POLYGON((1 2,1 5,4 5,
   4 2,1 2))'), ST_GeomFromText('POLYGON((3 1,3 3,5 3,5 1,3 1))')));
 ST_AsText
------------------
POLYGON ((4 3, 4 2, 3 2, 3 3, 4 3))
(1 row)
Two non-intersecting linestrings:

=> SELECT ST_AsText(ST_Intersection(ST_GeomFromText('LINESTRING(1 1,1 3,3 3)'),
   ST_GeomFromText('LINESTRING(1 5,1 7,-1 7)')));
        ST_AsText
--------------------------
 GEOMETRYCOLLECTION EMPTY
(1 row)