Share via


st_intersects function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Note

This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.

Returns true if the two input GEOMETRY values intersect.

Syntax

st_intersects ( geoExpr1, geoExpr2 )

Arguments

  • geoExpr1: A GEOMETRY value.
  • geoExpr2: A GEOMETRY value.

Returns

A value of type BOOLEAN, indicating whether the two input GEOMETRY values intersect each other.

For more details and the formal definition, see the Intersects predicate in the DE-9IM matrix definition.

The function returns NULL if any of the inputs is NULL.

Error conditions

Examples

-- 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