ST_Overlaps — Tests if a Geometry spatially overlaps another Geometry.
boolean ST_Overlaps(
bytea
Geometry, bytea
Geometry)
;
The Overlaps relation is defined for A/A, L/L and P/P situations. The overlaps predicate has the following equivalent definitions:
The geometries have some but not all points in common, they have the same dimension, and the intersection of the interiors of the two geometries has the same dimension as the geometries themselves.
a.Overlaps(b) «-» (dim(I(a)) = dim(I(b)) = dim(I(a) ∩I(b))) Ʌ (a ∩ b ≠ a) Ʌ (a ∩ b ≠ b)
Expressed in terms of the DE-9IM:
Case a ϵP, b ϵP or Case a ϵA, b ϵA:
a.Overlaps(b) «-» (I(a) ∩I(b)≠ᴓ) Ʌ (I(a) ∩E(b)≠ᴓ) Ʌ (E(a) ∩I(b)≠ᴓ) «-» a.Relate(b, ‘T*T***T**’)
Case a ϵL, b ϵL:
a.Overlaps(b) «-» (dim(I(a) ∩I(b) = 1) Ʌ (I(a) ∩E(b)≠ᴓ) Ʌ (E(a) ∩I(b)≠ᴓ) «-» a.Relate(b, ‘1*T***T**’)
If the geometries are of different dimension this predicate returns false.
The term P is used to refer to 0 dimensional geometries (Points and MultiPoints), L is used to refer to one-dimensional geometries (LineStrings and MultiLineStrings) and A is used to refer to two-dimensional geometries (Polygons and MultiPolygons). |
GeometryCollections are unsupported |
2D | 3D | M |
---|---|---|
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
---|---|---|---|
2.1.1.2 , 2.1.13.3 | 7.2.19.1 | 7.2.8.1 | 5.1.32 |
--Example 1 SELECT ST_Overlaps(PA,PB) from (SELECT ST_GeomFromText('POLYGON ((10 30, 0 10, 30 20, 30 30, 20 40, 10 30))') as PA, ST_GeomFromText('POLYGON ((10 40, 20 40, 20 20, 10 20, 10 40))') as PB) as foo; --Result TRUE --Example 2 SELECT ST_Overlaps(PA,PB) from (SELECT ST_GeomFromText('POLYGON ((10 30, 0 10, 30 20, 30 30, 20 40, 10 30))') as PA, ST_GeomFromText('POLYGON ((-1.5 40, 20 40, 10 30, -1 35, -1.5 40))') as PB) as foo; --Result FALSE
ST_Overlaps(A,B) = ST_Overlaps(B,A) =TRUE | ST_Overlaps(A,B) = FALSE |