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
| Parameter | Description |
|---|---|
raster_obj | The raster whose bounding box you want to retrieve. |
pyramid | The pyramid level of the raster. Valid values start from 0. |
csOption | The coordinate system for the returned bounding box. Defaults to WorldFirst. |
csOption values
| Value | Description |
|---|---|
Raster | Returns pixel coordinates. |
World | Returns world coordinates. |
WorldFirst | Returns world coordinates if the raster is georeferenced; otherwise falls back to pixel coordinates. |
Note: The return format is ((maxX,maxY),(minX,minY)) — the maximum values come first.Examples
Return pixel coordinates:
SELECT ST_Extent(raster_obj, 'Raster'::CoorSpatialOption) FROM raster_table;Result:
((255, 255), (0, 0))