Returns true if two geometry or geography objects share any part of space, and false otherwise.
Syntax
boolean ST_Intersects(geometry geomA, geometry geomB);
boolean ST_Intersects(geography geogA, geography geogB);Parameters
| Parameter | Description |
|---|---|
geomA | The first geometry object. |
geomB | The second geometry object. |
geogA | The first geography object. |
geogB | The second geography object. |
Usage notes
Two objects intersect if their spatial relationship is Overlap, Touch, or Within.
For geography inputs, the function applies a tolerance of 0.00001 meters: points within this distance are treated as intersecting. The calculation uses a sphere model, not an ellipsoid model.
The function automatically uses all available indexes on the geometry objects to compare their bounding boxes.
Examples
Check whether two line strings intersect
SELECT ST_Intersects('LINESTRING(0 0,1 1)'::geometry,'LINESTRING(0 1,1 0)'::geometry);
st_intersects
---------------
t
(1 row)