The ST_Disjoint() function
The ST_Disjoint() function takes two
geometries and returns t
(TRUE) if the two geometries
are completely non-intersecting; otherwise, it returns f
(FALSE).
Syntax
ST_Disjoint(g1 ST_Geometry, g2 ST_Geometry)
Usage
The following figure shows various geometric objects that do not touch each other.
The results of the spatial relationship of the ST_Disjoint() function can be understood or verified by comparing the results with a pattern matrix that represents the acceptable values for the DE-9IM. The ST_Disjoint() function pattern matrix states that neither the interiors nor the boundaries of either geometry intersect.
b | ||||
---|---|---|---|---|
Interior | Boundary | Exterior | ||
Interior | F | F | * | |
a | Boundary | F | F | * |
Exterior | * | * | * |
Return type
BOOLEAN
Example
An insurance company wants to assess the insurance coverage for the town's hospital, nursing homes, and schools. Part of this process includes determining the threat that the hazardous waste sites pose to each institution. Currently, the insurance company wants to consider only those institutions that are not at risk of contamination. The insurance company commissions a GIS consultant to locate all institutions that are outside a 5-mile radius of a hazardous waste storage facility.
CREATE TABLE sensitive_areas (id integer,
name varchar(128),
size float,
type varchar(10),
zone ST_Polygon);
CREATE TABLE hazardous_sites (site_id integer,
name varchar(40),
location ST_Point);
SELECT sa.name
FROM sensitive_areas sa, hazardous_sites hs
WHERE ST_Disjoint(ST_Buffer(hs.location,(5 * 5280)), sa.zone);
SELECT sa.name
FROM sensitive_areas sa, hazardous_sites hs
WHERE NOT ST_Intersects(ST_Buffer(hs.location,(5 * 5280)), sa.zone);
t
(TRUE)
when comparing sensitive sites to the 5-mile radius of the hazardous
waste sites. The ST_Disjoint() function returns t
whenever
two geometries do not intersect in any way.