This topic describes the ST_Intersects function. This function checks whether two geometry objects or two geography objects intersect. If the geometry objects or the geography objects share any part of space, the objects intersect.

Syntax

boolean  ST_Intersects(geometry  geomA , geometry  geomB);
boolean  ST_Intersects(geography  geogA , geography  geogB);

Parameters

Parameter Description
geomA The first geometry object that you want to specify.
geomB The second geometry object that you want to specify.
geogA The first geography object that you want to specify.
geogB The second geography object that you want to specify.

Description

  • If you specify two geography objects, this function uses a tolerance of 0.00001 meter. Any points that are within 0.00001 meter to each other are considered as intersected. In addition, this function uses a sphere model rather than an ellipsoid model.
  • If the relationship between the objects that you specify is Overlap, Touch, or Within, the objects intersect.
  • This function automatically compares the bounding boxes of the geometry objects that you specify by using all available indexes on the geometry objects.

Examples

Check whether two objects intersect by using the default parameter settings.
SELECT ST_Intersects('LINESTRING(0 0,1 1)'::geometry,'LINESTRING(0 1,1 0)'::geometry);
 st_intersects
---------------
 t
(1 row)