ST_Intersects¶
Introduction: Return true if A intersects B. Polymorphic over input type:
(Geometry, Geometry)— topological intersection via JTS.(Geography, Geography)— topological intersection via S2.(Box2D, Box2D)— closed-interval bbox intersection on both axes. Matches PostGIS&&onbox2d. Edge- and corner-touching boxes count as intersecting. ThrowsIllegalArgumentExceptionon inverted bounds.(Box3D, Box3D)— closed-interval bbox intersection on all three axes. Matches PostGIS&&&onbox3d. Edge-, face-, and corner-touching boxes count as intersecting. Throws on inverted bounds on any axis.
Format:
ST_Intersects(A: Geometry, B: Geometry)ST_Intersects(A: Geography, B: Geography)ST_Intersects(A: Box2D, B: Box2D)(Sincev1.9.1)ST_Intersects(A: Box3D, B: Box3D)(Sincev1.9.1)
Return type: Boolean
Since: v1.0.0
SQL Example
SELECT ST_Intersects(ST_GeomFromWKT('LINESTRING(-43.23456 72.4567,-43.23456 72.4568)'), ST_GeomFromWKT('POINT(-43.23456 72.4567772)'))
Output:
true
Box2D example:
SELECT ST_Intersects(
ST_MakeBox2D(ST_Point(0.0, 0.0), ST_Point(10.0, 10.0)),
ST_MakeBox2D(ST_Point(5.0, 5.0), ST_Point(15.0, 15.0)))
Output:
true
Box2D optimization¶
ST_Intersects(box_col, lit_box) over a Box2D column and a literal Box2D is recognised by Sedona's spatial optimizer:
- Filter pushdown. When the column is a
Box2Dstored in GeoParquet, the predicate translates to Parquet row-group inequalities on thexmin/ymin/xmax/ymaxleaves. See Box2D filter pushdown. - Spatial join.
ST_Intersects(a, b)between twoBox2Dcolumns is planned as a range or broadcast-index join. See Box2D spatial join.