ST_Envelope

Updated at:

Calculates the bounding rectangle of a raster object from its georeferencing information.

Syntax

geometry ST_Envelope(raster source);
geometry ST_Envelope(raster source,
                     integer pyramid);

Parameters

Parameter Name

Description

source

The raster object for the calculation.

pyramid

The pyramid level. Valid values start from 0. The default value is 0.

Description

The area outlined in red in the following figure is the bounding box of the raster object.

Bounding box

Example

SELECT st_astext(st_envelope(rast_object)) FROM raster_table;

----------------------------------------------------
 POLYGON((-180 90,180 90,180 -90,-180 -90,-180 90))

-- Specify the pyramid level                 
SELECT st_astext(st_envelope(rast_object,  1)) FROM raster_table;

----------------------------------------------------
 POLYGON((-180 90,180 90,180 -90,-180 -90,-180 90))