ST_Extent — Aggregate function that returns the bounding box of geometries.
box2d ST_Extent(
geometry set geomfield)
;
An aggregate function that returns a box2d bounding box that bounds a set of geometries.
The bounding box coordinates are in the spatial reference system of the input geometries.
ST_Extent is similar in concept to Oracle Spatial/Locator's SDO_AGGR_MBR.
ST_Extent returns boxes with only X and Y ordinates even with 3D geometries. To return XYZ ordinates use ST_3DExtent. |
The returned |
Melhorias: 2.0.0 suporte para superfícies poliédricas, triângulos e TIN introduzido.
This function supports Polyhedral surfaces.
This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).
Examples below use Massachusetts State Plane ft (SRID=2249) |
SELECT ST_Extent(geom) as bextent FROM sometable; st_bextent ------------------------------------ BOX(739651.875 2908247.25,794875.8125 2970042.75) --Return extent of each category of geometries SELECT ST_Extent(geom) as bextent FROM sometable GROUP BY category ORDER BY category; bextent | name ----------------------------------------------------+---------------- BOX(778783.5625 2951741.25,794875.8125 2970042.75) | A BOX(751315.8125 2919164.75,765202.6875 2935417.25) | B BOX(739651.875 2917394.75,756688.375 2935866) | C --Force back into a geometry -- and render the extended text representation of that geometry SELECT ST_SetSRID(ST_Extent(geom),2249) as bextent FROM sometable; bextent -------------------------------------------------------------------------------- SRID=2249;POLYGON((739651.875 2908247.25,739651.875 2970042.75,794875.8125 2970042.75, 794875.8125 2908247.25,739651.875 2908247.25))