Share via


st_covers function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns true if the first GEOMETRY covers the second GEOMETRY.

Syntax

st_covers ( geoExpr1, geoExpr2 )

Arguments

  • geoExpr1: The first GEOMETRY value.
  • geoExpr2: The second GEOMETRY value.

Returns

Returns true if the first geometry covers the second geometry. Currently, the expression does not support geometry collections. For more details on what it means for a geometry to cover another, see the Covers predicate in the DE-9IM matrix definition.

Error conditions

  • If any of the two input geometries is a geometry collection, an error is returned.
  • If the two input geometries have different SRID values, the function returns ST_DIFFERENT_SRID_VALUES.

Examples

> SELECT st_covers(st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'),st_geomfromtext('POINT(1 1)'))
  true

> SELECT st_covers(st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'),st_geomfromtext('POINT(5 0)'))
  true

> SELECT st_covers(st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'),st_geomfromtext('POINT(5 6)'))
  false