ST_Intersects
Determine whether two geometries intersect, that is, whether their DE-9IM intersection matrix is not FF*FF****
.
All coordinate systems are treated as being Cartesian.
Syntax
ST_Intersects(geo1, geo2);
- geo
- A table column of type VARCHAR(ANY) containing geometries.
- geo1
- The first input geometry.
Type: VARCHAR(ANY)
- geo2
- The second input geometry.
Type: VARCHAR(ANY)
Returns
A value of type BOOL that is TRUE if the two geometries intersect; otherwise FALSE.
Examples
CREATE TABLE points (PointID integer, the_geom VARCHAR(200));
INSERT INTO points VALUES (1, inza..ST_WKTToSQL('Point (0 0)'));
INSERT INTO points VALUES (2, inza..ST_WKTToSQL('Point (22 0)'));
INSERT INTO points VALUES (3, inza..ST_WKTToSQL('Point (33 33)'));
INSERT INTO points VALUES (4, inza..ST_WKTToSQL('Point (44 44)'));
SELECT inza..ST_Intersects(the_geom) from (SELECT the_geom from points order by PointID LIMIT 9999999) points;
ST_INTERSECTS
---------------
f
(1 row)
SELECT inza..ST_Intersects(inza..ST_WKTToSQL('POLYGON ((0 0, 11 0, 11 11, 0 11, 0 0))'),
inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))'));
ST_INTERSECTS
---------------
t
(1 row)
SELECT inza..ST_Intersects(inza..ST_WKTToSQL('POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))'),
inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))'));
ST_INTERSECTS
---------------
f
(1 row)
SELECT inza..ST_Intersects(inza..ST_WKTToSQL('POLYGON ((0 0, 0 4, 4 0, 0 0))'),
inza..ST_WKTToSQL('POLYGON ((0 5, 5 5, 5 0, 0 5))'));
ST_INTERSECTS
---------------
f
(1 row)