Name

ST_Extent — Returns the minimum bounding box of the specified geometries, that is, a single rectangle that minimally encloses the geometries.

Synopsis

PostgreSQL

geometry ST_Extent(bytea Geometry_Aggregate);

H2

geometry ST_ExtentAgg(bytea Geometry_Aggregate);

Alias

Extent

Description

Returns the minimum bounding box of the specified geometries, that is, a single rectangle that minimally encloses the geometries. The resulting Polygon will have the same SRID and coordinates units of the original geometries.

ST_Extent is an aggregate functions that return a single value, calculated from a set of values (a column or a subset of column values).

Coordinate Dimensions
2D3DM

-

-

Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

--Return the extent of the table townships.
SELECT ST_Extent(geom) as Extext FROM townships;

--Return the extent of each province.
SELECT ST_Extent(the_geom) as pextent FROM townships GROUP BY province ORDER BY province;

--Return the extent of a single township.
SELECT ST_Extent(geom) as Extext FROM townships WHERE town_name = 'Valencia';

Related functions

ST_Extent3D