제목

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 box3d value does not include a SRID. Use ST_SetSRID to convert it into a geometry with SRID metadata. The SRID is the same as the input geometries.

개선 사항: 2.0.0 버전부터 다면체 표면, 삼각형 및 TIN을 지원하기 시작했습니다.

This function supports Polyhedral surfaces.

This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).

예시

[참고]

Examples below use Massachusetts State Plane ft (SRID=2249)

Code
SELECT ST_Extent(geom) AS bextent FROM sometable;
래스터 출력
BOX(739651.875 2908247.25,794875.8125 2970042.75)

Return extent of each geometry category.

Code
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

This example converts the extent back into a geometry and renders its extended text representation.

Code
SELECT ST_SetSRID(ST_Extent(geom), 2249) AS bextent FROM sometable;
래스터 출력
SRID=2249;POLYGON((739651.875 2908247.25,739651.875 2970042.75,794875.8125 2970042.75,
794875.8125 2908247.25,739651.875 2908247.25))