All Products
Search
Document Center

ApsaraDB RDS:ST_Extent

Last Updated:Mar 28, 2026

Returns the bounding box of a raster as a PostgreSQL BOX value in ((maxX,maxY),(minX,minY)) format.

Syntax

BOX ST_Extent(raster raster_obj, CoorSpatialOption csOption = 'WorldFirst')
BOX ST_Extent(raster raster_obj, integer pyramid, CoorSpatialOption csOption = 'WorldFirst')

Parameters

ParameterDescription
raster_objThe raster object to query.
pyramidThe pyramid level to query. Valid values start from 0.
csOptionThe coordinate space to use. Default: WorldFirst.

Description

ST_Extent returns a BOX value representing the bounding box of the raster. The format is ((maxX,maxY),(minX,minY)) — the upper-right corner appears first, followed by the lower-left corner.

The csOption parameter controls which coordinate space is used:

ValueBehavior
RasterReturns pixel coordinates.
WorldReturns world (geographic) coordinates.
WorldFirstReturns world coordinates if the raster is georeferenced; otherwise returns pixel coordinates.
Note

WorldFirst is the default. If the raster is not georeferenced and you call ST_Extent without specifying csOption, the result is in pixel coordinates. To always get world coordinates, pass 'World'::CoorSpatialOption explicitly.

Examples

Return pixel coordinates:

SELECT ST_Extent(raster_obj, 'Raster'::CoorSpatialOption) FROM raster_table;

Result:

((255,255),(0,0))

Return world coordinates:

SELECT ST_Extent(raster_obj, 'World'::CoorSpatialOption) FROM raster_table;

Return world coordinates at a specific pyramid level:

SELECT ST_Extent(raster_obj, 2, 'World'::CoorSpatialOption) FROM raster_table;