Name

ST_Intersects — Tests if a Geometry spatially intersects another Geometry.

Synopsis

boolean ST_Intersects(bytea GeomA, bytea GeomB);

Alias

Intersects

Description

Tests whether this geometry intersects the specified geometry, returns True if so. The intersects predicate has the following equivalent definitions:

  • The two geometries have at least one point in common

  • Intersects is the inverse of Disjoint a.Intersects(b) «-» ! a.Disjoint(b)

  • The DE-9IM Intersection Matrix for the two geometries matches [T********] or [*T*******] or [***T*****] or [****T****]

[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.2 , 2.1.13.37.2.19.17.2.8.15.1.27

Examples

SELECT ST_Intersects(ga,gb) from 
 (SELECT ST_GeomFromText('LINESTRING (40 40, 180 180)') as ga, 
         ST_GeomFromText('LINESTRING (120 120, 20 200) ') as gb) as foo;
--Result
TRUE

SELECT ST_Intersects(ga,gb) from 
 (SELECT ST_GeomFromText('POINT (20 20)') as ga, 
         ST_GeomFromText('POLYGON ((60 120, 60 40, 160 40, 160 120, 60 120))') as gb) as foo;
--Result
FALSE
ST_Intersects(ga,gb) = TRUE
ST_Intersects(ga,gb) = FALSE

Related functions

ST_Disjoint,ST_Intersection, ST_Relate