Was this helpful?
Intersects
INTERSECTS(g1 Geometry, g2 Geometry)
Alias: ST_INTERSECTS
Returns 1 if g1 and g2 have any shared points; returns 0 otherwise. Returns the opposite of DISJOINT.
Result type: integer
Examples:
SELECT INTERSECTS(POLYFROMTEXT('POLYGON((0 10, 10 10, 8 0, 2 0, 0 10))'), POLYFROMTEXT('POLYGON((10 13, 20 13, 18 3, 12 3, 10 13))'));
-------------
col1
-------------
0
-------------
 
SELECT INTERSECTS(POLYFROMTEXT('POLYGON((0 10, 10 10, 8 0, 2 0, 0 10))'), POLYFROMTEXT('POLYGON((8 13, 18 13, 16 3, 10 3, 8 13))'));
-------------
col1
-------------
1
-------------
g2 is the intersection of g1 and another polygon.
SELECT INTERSECTS(POLYFROMTEXT('POLYGON((0 0, 10 0, 5 10, 0 0))'), INTERSECTION(POLYFROMTEXT('POLYGON((0 0, 10 0, 5 10, 0 0))'), POLYFROMTEXT('POLYGON((0 10, 5 10, 2.5 0, 0 10))')));
-------------
col1
-------------
1
-------------
Last modified date: 08/28/2024