Fork me on GitHub

ST_Intersects

Signatures

BOOLEAN ST_Intersects(GEOMETRY geomA, GEOMETRY geomB);

Description

Returns true if geomA intersects geomB.

Intersects means that geomA and geomB have at least one point in common.

This function does not work on GEOMETRYCOLLECTIONs.
Implements the OpenGIS Simple Features Implementation Specification for SQL version 1.2.1.
This predicate does not yet support spatial indices, but it will in a future release. Use it in conjunction with && operator. See here for more details.

Examples

Cases where ST_Intersects is true
SELECT ST_Intersects(geomA, geomB) FROM input_table;
-- Answer:    TRUE
geomA POLYGON geomB POLYGON
POLYGON((1 1, 4 1, 4 5, 1 5, 1 1)) POLYGON((3 2, 6 2, 6 6, 3 6, 3 2))

geomA POLYGON geomB LINESTRING
POLYGON((1 1, 4 1, 4 5, 1 5, 1 1)) LINESTRING(2 4, 7 4)

geomA POLYGON geomB POINT
POLYGON((1 1, 4 1, 4 5, 1 5, 1 1)) POINT(3 3)

geomA LINESTRING geomB LINESTRING
LINESTRING(2 1, 5 3, 2 6) LINESTRING(1 3, 4 6)

geomA LINESTRING geomB POINT
LINESTRING(2 1, 5 3, 2 6) POINT(2 6)

geomA POLYGON geomB MULTIPOLYGON
POLYGON((1 1, 4 1, 4 5, 1 5, 1 1)) MULTIPOLYGON(((4 2, 7 2, 7 6, 4 6, 4 2)), ((0 6, 1 6, 1 7, 0 7, 0 6)))

geomA POLYGON geomB MULTILINESTRING
POLYGON((1 1, 4 1, 4 5, 1 5, 1 1)) MULTILINESTRING((2 5, 7 5), (6 1, 6 4))

geomA POLYGON geomB MULTIPOINT
POLYGON((1 1, 4 1, 4 5, 1 5, 1 1)) MULTIPOINT((4 3), (6 2))

Cases where ST_Intersects is false
SELECT ST_Intersects(geomA, geomB) FROM input_table;
-- Answer:    FALSE
geomA POLYGON geomB POLYGON
POLYGON((1 1, 4 1, 4 5, 1 5, 1 1)) POLYGON((6 3, 7 3, 7 6, 6 6, 6 3))

See also