# ST_Expand function

The ST_Expand function enlarges the envelope of a geometry by a specified distance.

## Parameter

geometry
A value of type ST_Geometry which is to have its envelope expanded.
distance

A value of type DOUBLE that indicates the distance the buffer is to extend around the input geometry's current envelope.

unit

A value of type VARCHAR(128) that identifies the unit of distance.

If the unit parameter is omitted, the following rules are used to determine the unit of measure used for the result:
• If geometry1 is in a projected or geocentric coordinate system, the linear unit associated with this coordinate system is the default.
• If geometry1 is in a geographic coordinate system, the angular unit associated with this coordinate system is the default.
Restrictions on unit conversions: An error (SQLSTATE 38SU4) is returned if any of the following conditions occur:
• The geometry is in an unspecified coordinate system and the unit parameter is specified.
• The geometry is in a projected coordinate system and an angular unit is specified.
• The geometry is in a geographic coordinate system, but is not an ST_Point value, and a linear unit is specified.

## Return type

Returns a polygon comprising the input geometry's envelope, based on its spatial extent and expanded by the specified distance.

## Examples

``````create table points (pk integer not null primary key, geo ST_Point)

insert into points values(1, st_point(10,10))
insert into points values(2, st_point(10,15, 4326))
``````
``````
select substr(st_asText(st_expand(geo, 1.0, 'METER')),1,800) as expanded from points

Result:
EXPANDED
----------------------------------------------------------------------------------------------------------------
POLYGON ((9.999990877 9.999999998, 9.999990897 9.999999411, 9.999990897 9.999999407,
9.999990955 9.999998822, 9.999990955 9.999998818, 9.999991052 9.999998234,
9.999991188 9.999997658, 9.999991361 9.999997092, 9.999991571 9.999996538,
9.999991818 9.999995999, 9.999992099 9.999995478, 9.999992414 9.999994975,
9.999992762 9.999994494, 9.999993141 9.999994037, 9.999993549 9.999993605,
9.999993984 9.999993201, 9.999994446 9.999992825, 9.999994931 9.999992481,
9.999995438 9.999992168, 9.999995964 9.999991889, 9.999996508 9.999991645,
9.999997066 9.999991437, 9.999997637 9.999991265, 9.999998219 9.999991131,
9.999998807 9.999991034, 9.999999401 9.999990976, 9.999999998 9.999990957,
10.000000002 9.999990957, 10.000000595 9.999990976, 10.000000599 9.999990976,
10.000001189 9.999991034, 10.00000119 (...)
POLYGON ((9.999990700 14.999999998, 9.999990720 14.999999411, 9.999990720
14.999999407, 9.999990780 14.999998822, 9.999990780 14.999998818, 9.999990879 14.999998235,
9.999991017 14.999997659, 9.999991193 14.999997093, 9.999991408 14.999996539,
9.999991659 14.999996001, 9.999991946 14.999995479, 9.999992267 14.999994977,
9.999992621 14.999994496, 9.999993007 14.999994039, 9.999993423 14.999993607,
9.999993867 14.999993203, 9.999994338 14.999992828, 9.999994832 14.999992484,
9.999995349 14.999992171, 9.999995886 14.999991892, 9.999996440 14.999991648,
9.999997009 14.999991440, 9.999997592 14.999991268, 9.999998184 14.999991134,
9.999998784 14.999991038, 9.999999390 14.999990980, 9.999999998 14.999990960,
10.000000002 14.999990960, 10.000000606 14.999990980, 10.000000610 14.999990980,
10.0000 (...)
``````