User's Guide and Reference

ST_SymmetricDiff

ST_SymmetricDiff takes two geometry objects and returns a geometry object that is the symmetrical difference of the source objects.

Syntax

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

Return type

db2gse.ST_Geometry

Examples

The county supervisor must determine the area of sensitive areas and five-mile hazardous site radius that is not intersected.

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 the HAZARDOUS_SITES table, which stores the identity of the sites in the SITE_ID and NAME columns, while 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  point); 

The ST_Buffer function generates a five-mile buffer surrounding the hazardous waste site locations. The ST_SymmetricDiff function generates polygons from the intersection of the buffered hazardous waste site polygons and the sensitive areas. The ST_Area function returns the intersection polygon's area for each hazardous site.

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

Figure 38. Using ST_SymmetricDiff to determine the hazardous waste areas that do not contain sensitive areas (inhabited buildings)


top

In Figure 38, the symmetric difference of the hazardous waste sites and the sensitive areas results in the subtraction of the intersected areas.


[ Top of Page | Previous Page | Next Page ]