Name

ST_Box2D — Returns a Polygon geometry representation of the two-dimensional bounding box.

Synopsis

geometry ST_Box2D(bytea Geometry);

Alias

Box2D

Description

Returns a Polygon geometry representation of the two-dimensional bounding box. The resulting Polygon will have the same SRID and coordinates units of the original geometries.

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

SELECT ST_AsText(Box2D(ST_GeomFromText('LINESTRING (1 1, 2 3, 3 2, 4 4)')));
--Result
POLYGON ((1 1, 1 4, 4 4, 4 1, 1 1))

SELECT ST_AsEWKT(ST_SetSRID(ST_Box2D(ST_GeomFromText('LINESTRING (1 1, 2 3, 3 2, 4 4)')),25830));
--Result
SRID=25830;POLYGON ((1 1, 1 4, 4 4, 4 1, 1 1))

Related functions

ST_Box3D,ST_Box