Returns the bounding box of a grid cell as a PostgreSQL box value.
Syntax
box ST_AsBox(geomgrid grid);
box[] ST_AsBox(geomgrid[] grid);Pass a single geomgrid to get a single box. Pass a geomgrid array to get a box array.
Parameters
| Parameter | Description |
|---|---|
grid | The grid cell whose bounding box to retrieve. |
Examples
Single grid cell
SELECT ST_AsBox(
ST_GridFromText('G0013103220310313'));Output:
(116.4588888888889,39.30888888888889),(116.46666666666667,39.31666666666667)Array of grid cells
SELECT ST_AsBox(ST_AsGrid(
'SRID=4490;LINESTRING(122.48077 51.72814,122.47416 51.73714)'::geometry, 15));Output:
{(122.46666666666667,51.71666666666667),(122.48333333333333,51.733333333333334);
(122.46666666666667,51.733333333333334),(122.48333333333333,51.75)}Each element in the array corresponds to one grid cell that covers the input geometry.
See also
ST_GridFromText— construct ageomgridvalue from its text representationST_AsGrid— convert a geometry to thegeomgridcells that cover it