ST_Expand — Expands the Polygon that represents the Bounding Box in all directions.
geometry ST_Expand(bytea
Geometry, double
Expand_Units);
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.
| 2D | 3D | M |
|---|---|---|
![]() | ![]() | - |
| 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 |
|---|---|---|---|
| - | - | - | - |
--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))![]() | ![]() |
--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))