st_intersects
function
Applies to: Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
Returns true if the two geometries intersect.
Syntax
st_intersects ( geo1, geo2 )
Arguments
geo1
: AGEOMETRY
value.geo2
: AGEOMETRY
value.
Returns
A value of type BOOLEAN
, true if the two geometries intersect.
The function returns NULL
if any of the inputs is NULL
.
Error conditions
- If any of the input geometries is a geometry collection, the function returns ST_INVALID_ARGUMENT_TYPE.
- If the input geometries do not have the same SRID value, the function returns ST_DIFFERENT_SRID_VALUES.
Examples
SQL
-- Returns true if geometries intersect.
> SELECT st_intersects(st_geomfromtext('POINT(1 1)'),st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'));
true
-- Returns false if geometries do not intersect.
> SELECT st_intersects(st_geomfromtext('POINT(5 6)'),st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'));
false