跳转至
Apache Sedona 1.9.0 已正式发布,新增 Spark 4.1 支持、proj4sedona 坐标系转换、Bing Tile 函数等众多特性!

ST_BoxIntersects

Introduction: Closed-interval bbox intersection over two Box2D arguments. Returns true if the boxes overlap on both the X and Y axes. Matches PostGIS && on box2d. Edge- and corner-touching boxes count as intersecting.

The predicate is symmetric — ST_BoxIntersects(a, b) and ST_BoxIntersects(b, a) return the same value.

Format: ST_BoxIntersects(a: Box2D, b: Box2D)

Return type: Boolean

Since: v1.9.1

SQL Example

SELECT ST_BoxIntersects(
    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

Optimization

ST_BoxIntersects(box_col, lit_box) is recognised by Sedona's spatial optimizer:

  • Filter pushdown. When the column is a Box2D stored in GeoParquet, the predicate translates to Parquet row-group inequalities on the xmin / ymin / xmax / ymax leaves. See Box2D filter pushdown.
  • Spatial join. ST_BoxIntersects(a, b) between two Box2D columns is planned as a range or broadcast-index join. See Box2D spatial join.

Errors

Throws IllegalArgumentException if either argument has inverted bounds (xmin > xmax or ymin > ymax). Inverted-bound values are reserved for a future antimeridian-wraparound semantics; planar predicates have no defined meaning for them today.

Returns NULL if either argument is NULL.