Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks SQL
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 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: AGEOMETRYcolumn.
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
- If the input contains geometries with different SRID values, the function returns ST_DIFFERENT_SRID_VALUES.
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