The ST_Overlaps() function
The ST_Overlaps() function returns t
(TRUE)
if the intersection of two ST_Geometry objects results in an ST_Geometry
object of the same dimension but not equal to either source object.
Otherwise, it returns f
(FALSE).
Syntax
ST_Overlaps(g1 ST_Geometry, g2 ST_Geometry)
Usage
The results of the spatial relationship of the ST_Operlaps() 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_Operlaps() function returns TRUE if the intersection of the objects results in an object of the same dimension but not equal to either source object.
Interior (b) | Boundary (b) | Exterior (b) | |
---|---|---|---|
Interior (a) | T | * | T |
Boundary (a) | * | * | * |
Exterior (a) | T | * | * |
Interior (b) | Boundary (b) | Exterior (b) | |
---|---|---|---|
Interior (a) | 1 | * | T |
Boundary (a) | * | * | * |
Exterior (a) | T | * | * |
Return type
BOOLEAN
Example
The county supervisor needs a list of hazardous waste sites whose 5-mile radius overlaps sensitive areas.
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);
t
(TRUE)
for all sensitive_areas rows whose zone polygons overlap
the buffered 5-mile radius of the hazardous_sites location
points: SELECT hs.name hazardous_site, sa.name sensitive_area
FROM hazardous_sites hs, sensitive_areas sa
WHERE ST_Overlaps(ST_Buffer(hs.location,(26400)),sa.zone);
hazardous_site Landmark Industrial
sensitive_area Johnson County Hospital
hazardous_site Landmark Industrial
sensitive_area Summerhill Elementary School