PostGIS

ST_Overlaps

Prev

8.11.1. Topological Relationships

Next

Name

ST_Overlaps — Tests if two geometries intersect and have the same dimension, but are not completely contained by each other.

Synopsis

boolean +`*`+ST_Overlaps*(`geometry `A, geometry B`)`;

Description

Returns TRUE if geometry A and B "spatially overlap". Two geometries overlap if they have the same dimension, each has at least one point not shared by the other (or equivalently neither covers the other), and the intersection of their interiors has the same dimension. The overlaps relationship is symmetrical.

Note

This function automatically includes a bounding box comparison that makes use of any spatial indexes that are available on the geometries. To avoid index use, use the function _ST_Overlaps.

Performed by the GEOS module

Important

Enhanced: 3.0.0 enabled support for GEOMETRYCOLLECTION

this is the "allowable" version that returns a boolean, not an integer.

check This method implements the OGC Simple Features Implementation Specification for SQL 1.1. s2.1.1.2 // s2.1.13.3

check This method implements the SQL/MM specification. SQL-MM 3: 5.1.32

Examples

ST_Overlaps returns TRUE in the following situations:

st_overlaps01

MULTIPOINT / MULTIPOINT

st_overlaps02

LINESTRING / LINESTRING

st_overlaps03

POLYGON / POLYGON

st_overlaps04

A Point on a LineString is contained, but since it has lower dimension it does not overlap or cross.

SELECT ST_Overlaps(a,b) AS overlaps,       ST_Crosses(a,b) AS crosses,
       ST_Intersects(a, b) AS intersects,  ST_Contains(b,a) AS b_contains_a
FROM (SELECT ST_GeomFromText('POINT (100 100)') As a,
             ST_GeomFromText('LINESTRING (30 50, 40 160, 160 40, 180 160)')  AS b) AS t

overlaps | crosses | intersects | b_contains_a
---------+----------------------+--------------
f        | f       | t          | t

st_overlaps05

A LineString that partly covers a Polygon intersects and crosses, but does not overlap since it has different dimension.

SELECT ST_Overlaps(a,b) AS overlaps,        ST_Crosses(a,b) AS crosses,
       ST_Intersects(a, b) AS intersects,   ST_Contains(a,b) AS contains
FROM (SELECT ST_GeomFromText('POLYGON ((40 170, 90 30, 180 100, 40 170))') AS a,
             ST_GeomFromText('LINESTRING(10 10, 190 190)') AS b) AS t;

 overlap | crosses | intersects | contains
---------+---------+------------+--------------
 f       | t       | t          | f

st_overlaps06

Two Polygons that intersect but with neither contained by the other overlap, but do not cross because their intersection has the same dimension.

SELECT ST_Overlaps(a,b) AS overlaps,       ST_Crosses(a,b) AS crosses,
       ST_Intersects(a, b) AS intersects,  ST_Contains(b, a) AS b_contains_a,
       ST_Dimension(a) AS dim_a, ST_Dimension(b) AS dim_b,
       ST_Dimension(ST_Intersection(a,b)) AS dim_int
FROM (SELECT ST_GeomFromText('POLYGON ((40 170, 90 30, 180 100, 40 170))') AS a,
             ST_GeomFromText('POLYGON ((110 180, 20 60, 130 90, 110 180))') AS b) As t;

 overlaps | crosses | intersects | b_contains_a | dim_a | dim_b | dim_int
----------+---------+------------+--------------+-------+-------+-----------
 t        | f       | t          | f            |     2 |     2 |       2

See Also

Prev

Up

Next

ST_OrderingEquals

Home

ST_Relate