ST_Intersects — Tests if a Geometry spatially intersects another Geometry.
boolean ST_Intersects(
bytea GeomA, bytea GeomB)
;
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****]
GeometryCollections are unsupported |
2D | 3D | M |
---|---|---|
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.3 | 7.2.19.1 | 7.2.8.1 | 5.1.27 |
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 |