Share via


st_envelope function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns a 2D Cartesian geometry representing the 2D axis-aligned minimum bounding box (envelope) of the input geometry. 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)