ST_Buffer takes a geometry object and distance and returns the geometry object that surrounds the source object.
Syntax
db2gse.ST_Buffer(g db2gse.ST_Geometry , adistance Double)
Return type
db2gse.ST_Geometry
Examples
The County Supervisor needs a list of hazardous sites whose five-mile radius overlaps sensitive areas such as schools, hospitals, and nursing homes. The sensitive areas are stored in the table SENSITIVE_AREAS that is created with the following CREATE TABLE statement. The ZONE column is defined as a polygon, which is stored as the outline of each sensitive area.
CREATE TABLE SENSITIVE_AREAS (id integer, name varchar(128), size float, type varchar(10), zone db2gse.ST_Polygon);
The hazardous sites are stored in the HAZARDOUS_SITES table that is created with the following CREATE TABLE statement. The LOCATION column, defined as a point, stores a location that is the geographic center of each hazardous site.
CREATE TABLE HAZARDOUS_SITES (site_id integer, name varchar(128), location db2gse.ST_Point);
The SENSITIVE_AREAS and HAZARDOUS_SITES tables are joined by the db2gse.ST_Overlaps function. The function returns 1 (TRUE) for all SENSITIVE_AREAS rows whose zone polygons overlap the buffered five-mile radius of the HAZARDOUS_SITES location point.
SELECT sa.name "Sensitive Areas", hs.name "Hazardous Sites" FROM SENSITIVE_AREAS sa, HAZARDOUS_SITES hs WHERE db2gse.ST_Overlaps(sa.zone, db2gse.ST_Buffer (hs.location,(5 * 5280))) = 1;
In Figure 29, some of the sensitive areas in this administrative district lie within the five-mile buffer of the hazardous site locations. Both of the five-mile buffers intersect the hospital, and one of them intersects the school. However the nursing home lies safely outside both radii.
Figure 29. A buffer with a five-mile radius is applied to a point