User's Guide and Reference

ST_Union

ST_Union takes two geometry objects and returns a geometry object that is the union of the source objects.

Syntax

db2gse.ST_Union(g1 db2gse.ST_Geometry, g2 db2gse.ST_Geometry)

Return type

db2gse.ST_Geometry

Examples

The following CREATE TABLE statement creates the SENSITIVE_AREAS table, which contains several columns that describe the threatened institutions. The SENSITIVE_AREAS table also contains the ZONE column, which stores the institution's polygon geometry.

CREATE TABLE SENSITIVE_AREAS (id        integer,
                              name      varchar(128),
                              size      float,
                              type      varchar(10),
                              zone      db2gse.ST_Polygon); 

The following CREATE TABLE statement creates the HAZARDOUS_SITES table, which stores the identity of the sites in the SITE_ID and NAME columns. The actual geographic location of each site is stored in the LOCATION point column.

CREATE TABLE HAZARDOUS_SITES (site_id integer, name varchar(128), 
location db2gse.ST_Point); 

The following SELECT statement uses the ST_Buffer function to generate a five-mile buffer surrounding the hazardous waste site locations. The ST_Union function generates polygons from the union of the buffered hazardous waste site polygons and the sensitive areas. The ST_Area function returns the union of polygon's area.

SELECT sa.name, hs.name,
       db2gse.ST_Area(db2gse.ST_Union(db2gse.ST_Buffer(hs.location,
(5 * 5280)),sa.zone))
FROM HAZARDOUS_SITES hs, SENSITIVE_AREAS sa; 


[ Top of Page | Previous Page | Next Page ]