ST_Disjoint takes two geometries and returns 1 (TRUE) if the intersection of two geometries produces an empty set; otherwise it returns 0 (FALSE).
Syntax
db2gse.ST_Disjoint(g1 db2gse.ST_Geometry, g2 db2gse.ST_Geometry)
Return type
Integer
Examples
An insurance company needs to assess the insurance coverage for a town's hospital, nursing homes, and schools. Part of this process includes determining the threat that the hazardous waste sites pose to each institution. The insurance company wants to consider only those institutions that are not at risk of contamination. The GIS consultant hired by the insurance company has been commissioned to locate all institutions that are not within a five-mile radius of a hazardous waste site.
The SENSITIVE_AREAS table contains several columns that describe the threatened institutions in addition to 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 HAZARDOUS_SITES table 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 column.
CREATE TABLE HAZARDOUS_SITES (site_id integer, name varchar(128), location db2gse.ST_Point);
The following SELECT statement lists the names of all sensitive areas that are not within the 5- mile radius of a hazardous waste site. The ST_Intersects function could replace the ST_Disjoint function in this query if the result of the function is set equal to 0 instead of 1. This is because ST_Intersects and ST_Disjoint return the exact opposite result.
SELECT sa.name FROM SENSITIVE_AREAS sa, HAZARDOUS_SITES hs WHERE db2gse.ST_Disjoint(db2gse.ST_Buffer(hs.location,(5 * 5280)),sa.zone) = 1;
In Figure 32, sensitive are sites are compared to the five-mile radius of the hazardous waste sites. The nursing home is the only sensitive area where the ST_Disjoint function will return 1 (TRUE). The ST_Disjoint function returns 1 whenever two geometries do not intersect in any way.