ST_OVERLAPS()
All functions > GEOSPATIAL > ST_OVERLAPS()
Returns TRUE if two geometries of the same dimension have overlapping interiors.
Signatures
Overlaps
Returns: TRUE if A overlaps B
ST_OVERLAPS(geo1: T, geo2: T) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo1 | T | Yes | First geometry |
geo2 | T | Yes | Second geometry |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY
Signature notes:
- Only meaningful when both operands have the same dimension (Polygon/Polygon, Line/Line)
- Different dimensions always return FALSE
- Not supported on BigQuery
- GEOMETRY only (no GEOGRAPHY overload)
- Returns NULL if either input is NULL
Examples
FeatureQL
SELECT
-- Two partially overlapping polygons
f1 := ST_OVERLAPS(
ST_GEOMFROMTEXT('POLYGON ((0 0, 3 0, 3 3, 0 3, 0 0))'),
ST_GEOMFROMTEXT('POLYGON ((2 2, 5 2, 5 5, 2 5, 2 2))')
),
-- Two disjoint polygons do not overlap
f2 := ST_OVERLAPS(
ST_GEOMFROMTEXT('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))'),
ST_GEOMFROMTEXT('POLYGON ((5 5, 6 5, 6 6, 5 6, 5 5))')
)
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
On this page