Returns the bounding box of a raster as a geometry polygon.
Syntax
geometry ST_Envelope(raster source)
geometry ST_Envelope(raster source, integer pyramid)Parameters
| Parameter | Description |
|---|---|
source | The source raster. |
pyramid | The pyramid level of the raster. Valid values start from 0. Default value: 0. |
Description
ST_Envelope returns the bounding box of a raster as a polygon.

Use the pyramid parameter to get the bounding box at a specific pyramid level.
Examples
Return the bounding box of a raster at the default pyramid level (0):
SELECT ST_AsText(ST_Envelope(rast_object))
FROM raster_table;Result:
POLYGON((-180 90,180 90,180 -90,-180 -90,-180 90))Return the bounding box at pyramid level 1:
SELECT ST_AsText(ST_Envelope(rast_object, 1))
FROM raster_table;Result:
POLYGON((-180 90,180 90,180 -90,-180 -90,-180 90))