ST_CROSSES()
All functions > GEOSPATIAL > ST_CROSSES()
Returns TRUE if two geometries have some but not all interior points in common.
Signatures
Crosses
Returns: TRUE if A crosses B
ST_CROSSES(geo1: T, geo2: T) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo1 | T | Yes | First geometry or geography |
geo2 | T | Yes | Second geometry or geography |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY
Signature notes:
- Only meaningful for certain dimension combinations: Line/Line, Line/Polygon
- Point/Point and Polygon/Polygon always return FALSE
- Not supported on BigQuery
- GEOMETRY only (no GEOGRAPHY overload)
- Returns NULL if either input is NULL
Examples
FeatureQL
SELECT
f1 := ST_CROSSES(ST_GEOMFROMTEXT('LINESTRING (0 0, 2 2)'), ST_GEOMFROMTEXT('LINESTRING (0 2, 2 0)')), -- Two crossing lines
f2 := ST_CROSSES(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1)'), ST_GEOMFROMTEXT('LINESTRING (2 2, 3 3)')) -- Parallel lines do not cross
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
On this page