ST_Overlaps
Determines if a GEOMETRY object shares space with another GEOMETRY object, but is not completely contained within that object. They must overlap at their interiors. If two objects touch at a single point or intersect only along a boundary, they do not overlap. Both parameters must have the same dimension; otherwise, ST_Overlaps returns FALSE.
Behavior Type
Syntax
ST_Overlaps ( g1, g2 )
Arguments
g1 |
Spatial object, type GEOMETRY |
g2 |
Spatial object, type GEOMETRY |
Returns
BOOLEAN
Supported Data Types
| Data Type | GEOMETRY |
| Point |
Yes |
| Multipoint |
Yes |
| Linestring |
Yes |
| Multilinestring |
Yes |
| Polygon |
Yes |
| Multipolygon |
Yes |
| GeometryCollection |
Yes |
Examples
The following examples show how to use ST_Overlaps.
Polygon_1 overlaps but does not completely contain Polygon_2:
=> SELECT ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 0 0))'),
ST_GeomFromText('POLYGON((0.5 0.5, 0.7 0.5, 0.7 0.7, 0.5 0.7, 0.5 0.5))'));
ST_Overlaps
-------------
t
(1 row)
Two objects with different dimensions:
=> SELECT ST_Overlaps(ST_GeomFromText('LINESTRING(2 2,4 4)'),
ST_GeomFromText('POINT(3 3)'));
ST_Overlaps
-------------
f
(1 row)