Name

ST_Expand — Expands the Polygon that represents the Bounding Box in all directions.

Synopsis

geometry ST_Expand(bytea Geometry, double Expand_Units);

Alias

Expand

Description

Expands the Polygon that represents the Bounding Box in all directions. A 3d Bounding Box will also be extended in Z direction.

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

--2D LineString
SELECT ST_AsText(ST_Box(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_AsText(ST_Expand(ST_GeomFromText('LINESTRING (1 1, 2 3, 3 2, 4 4)'),1));
--Result
POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))
ST_Box(GeomA)
ST_Expand(GeomA,1)
--3D LineString
SELECT ST_AsText(ST_Expand(ST_GeomFromText('LINESTRING (1 1 -5, 2 3 10, 3 2 5, 4 4 0)'),1));
--Result
POLYGON ((0 0 -6, 0 5 11, 5 5 11, 5 0 -6, 0 0 -6))

Related functions

ST_Box