Share via


st_touches 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 touch each other.

Syntax

st_touches ( geo1, geo2 )

Arguments

  • geo1: The first GEOMETRY value.
  • geo2: The second GEOMETRY value.

Returns

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

The function does not support geometry collections.

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

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

Error conditions

Examples

-- Returns false when geometries do not touch.
> SELECT st_touches(st_geomfromtext('LINESTRING(5 0,5 10)'),st_geomfromtext('MULTILINESTRING((0 0,10 10),(0 10,10 0))'));
  false
-- Returns true when geometries touch.
> SELECT st_touches(st_geomfromtext('LINESTRING(5 0,5 5)'),st_geomfromtext('MULTILINESTRING((0 0,10 10),(0 10,10 0))'));
  true