PostGIS
Synopsis
boolean +`*`+ST_Intersects
*(
geometry geomA
, geometry
geomB
)
;
boolean +`*`+ST_Intersects
*(
geography geogA
, geography
geogB
)
;
Description
Returns true
if two geometries intersect. Geometries intersect if
they have any point in common.
For geography, a distance tolerance of 0.00001 meters is used (so points that are very close are considered to intersect).
In mathematical terms: [.emphasis]#ST_Intersects(A, B) ⇔ A ⋂ B ≠ ∅ #
Geometries intersect if their DE-9IM Intersection Matrix matches one of:
-
T********
-
*T*******
-
***T*****
-
****T****
Spatial intersection is implied by all the other spatial relationship tests, except ST_Disjoint, which tests that geometries do NOT intersect.
|
Changed: 3.0.0 SFCGAL version removed and native support for 2D TINS added.
Enhanced: 2.5.0 Supports GEOMETRYCOLLECTION.
Enhanced: 2.3.0 Enhancement to PIP short-circuit extended to support MultiPoints with few points. Prior versions only supported point in polygon.
Performed by the GEOS module (for geometry), geography is native
Availability: 1.5 support for geography was introduced.
|
|
[.inlinemediaobject] This method implements the OGC Simple Features Implementation Specification for SQL 1.1.
s2.1.1.2 //s2.1.13.3 - ST_Intersects(g1, g2 ) -→ Not (ST_Disjoint(g1, g2 ))
This method implements the SQL/MM specification.
SQL-MM 3: 5.1.27
This method supports Circular Strings and Curves.
This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).
Geometry Examples
SELECT ST_Intersects('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry);
st_intersects
---------------
f
(1 row)
SELECT ST_Intersects('POINT(0 0)'::geometry, 'LINESTRING ( 0 0, 0 2 )'::geometry);
st_intersects
---------------
t
(1 row)
-- Look up in table. Make sure table has a GiST index on geometry column for faster lookup.
SELECT id, name FROM cities WHERE ST_Intersects(geom, 'SRID=4326;POLYGON((28 53,27.707 52.293,27 52,26.293 52.293,26 53,26.293 53.707,27 54,27.707 53.707,28 53))');
id | name
----+-------
2 | Minsk
(1 row)
Geography Examples
SELECT ST_Intersects(
'SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456 72.4568)'::geography,
'SRID=4326;POINT(-43.23456 72.4567772)'::geography
);
st_intersects
---------------
t