User's Guide and Reference

ST_Intersects

ST_Intersects takes two geometries and returns 1 (TRUE), if the intersection of two geometries does not result in an empty set. Otherwise, it returns 0 (FALSE).

Syntax

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

Return type

Integer

Examples

The fire marshall needs a list of all sensitive areas within a five-mile radius of a hazardous waste site.

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 that stores the outline of each of the sensitive areas.

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 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 query returns a list of sensitive areas and hazardous site names for sensitive areas that intersect the five-mile buffer of the hazardous sites.

SELECT sa.name, hs.name
FROM SENSITIVE_AREAS sa, HAZARDOUS_SITES hs
WHERE db2gse.ST_Intersects(db2gse.ST_Buffer(hs.location,(5 * 5280)),sa.zone) = 1; 


[ Top of Page | Previous Page | Next Page ]