Share via


st_envelope 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 a 2D Cartesian GEOMETRY value representing the 2D axis-aligned minimum bounding box (envelope) of the input GEOMETRY value. If the input geometry is empty, it is returned as entered.

Syntax

st_envelope ( geoExpr )

Arguments

  • geoExpr: A GEOMETRY value.

Returns

A value of type GEOMETRY, representing the 2D axis-aligned minimum bounding box of the input geometry.

The function returns NULL if the input is NULL.

Examples

-- Returns the envelope of a polygon geometry.
> SELECT st_astext(st_envelope(st_geomfromtext('POLYGON((-1 0,0 -1,1 0,0 1,-1 0))')));
  POLYGON((-1 -1,-1 1,1 1,1 -1,-1 -1))
-- Returns the envelope of a point geometry.
> SELECT st_astext(st_envelope(st_geomfromtext('POINT(5 10)')));
  POINT(5 10)