ST_Expand function

The ST_Expand function enlarges the envelope of a geometry by a specified distance measured in the default or given unit.

Syntax

Read syntax diagramSkip visual syntax diagram db2gse.ST_Expand ( geometry , distance ,unit )

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(256) 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 db2gse.ST_Point) organize by row;

insert into points values(1, db2gse.st_point(10,10, 1));
insert into points values(2, db2gse.st_point(10,15, 1));

select substr(db2gse.st_asText(db2gse.st_expand(geo, 1.0)),1,200) as expanded from points where pk = 2;

Result:
EXPANDED
------------------------------------------------------------------------------------------------------------
POLYGON ((9.985034 14.999998, 9.985066 14.999050, 9.985066 14.999046, 9.985163 14.998103, 9.985163 14.998099, 
   9.985322 14.997160, 9.985545 14.996233, 9.985829 14.995322, 9.986174 14.994432, 9.986578 1  

1 record(s) selected.

select substr(db2gse.st_asText(db2gse.st_expand(geo, 1.0, 'METER')),1,200) as expanded from points where pk = 4326

Result:
EXPANDED
----------------------------------------------------------------------------------------------------------------
POLYGON ((9.999990815 11.999999998, 9.999990835 11.999999411, 9.999990835 11.999999407, 9.999990894 11.999998822, 
   9.999990894 11.999998818, 9.999990992 11.999998234, 9.999991128 11.999997658, 9.999991

1 record(s) selected.