Share via


st_envelope_agg function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns the envelope of all the geometries in the column, or NULL if the column has zero rows, or contains only NULL values.

Syntax

st_envelope_agg ( geoCol )

Arguments

  • geoCol: A GEOMETRY column.

Returns

A value of type GEOMETRY, representing the envelope of all geometries in the column.

The function returns NULL if the column has zero rows or contains only NULL values.

Error conditions

Examples

-- Returns the envelope of multiple geometries.
> SELECT st_astext(st_envelope_agg(st_geomfromtext(*))) FROM (SELECT * FROM VALUES('POINT(-5 -5)'),('MULTIPOINT(1 2,8 8,5 9,-7 -7,EMPTY)'),('MULTILINESTRING(EMPTY,(5 5,9 9),(9 9,15 15))'),('POLYGON((0 0,10 0,10 10,0 10,0 0))'))
  POLYGON((-7 -7,-7 15,15 15,15 -7,-7 -7))
-- Returns NULL for an empty result set.
> SELECT st_envelope_agg(st_geomfromtext(geom)) FROM (SELECT 'POINT(1 1)' as geom WHERE false)
  NULL