ST_Intersects()

Returns 1 when two geometries intersect.

Syntax

ST_Intersects(geom1, geom2)

Aliases: none.

Arguments

geom1 and geom2 are GEOMETRY values.

Return Value

Returns BOOL.

Usage Notes

  • ST_Intersects() is the logical opposite of ST_Disjoint() for the same pair.

  • Both geometries must have the same SRID. Predicates are Cartesian (SRID 0), not geodetic SRID 4326 predicates.

Examples

DROP DATABASE IF EXISTS geo_intersects_demo;
CREATE DATABASE geo_intersects_demo;
USE geo_intersects_demo;

SELECT ST_Intersects(ST_GeomFromText('LINESTRING(0 0, 2 2)'), ST_GeomFromText('LINESTRING(0 2, 2 0)')) AS lines_intersect;

DROP DATABASE geo_intersects_demo;

See Also

ST_Disjoint(), ST_Touches().