Tests if a geometry value overlaps another geometry value.
geometry-expression.ST_Overlaps(geo2)
Name | Type | Description |
---|---|---|
geo2 |
ST_Geometry |
The other geometry value that is to be compared to the geometry-expression. |
Returns 1 if the geometry-expression overlaps geo2, otherwise 0. Returns NULL if geometry-expression and geo2 have different dimensions.
Two geometries overlap if the following conditions are all true:
Both geometries have the same dimension.
The intersection of geometry-expression and geo2 geometries has the same dimension as geometry-expression.
Neither of the original geometries is a subset of the other.
More precisely, geometry-expression.ST_Overlaps( geo2 ) returns 1 when the following is TRUE:
geometry-expression.ST_Dimension() = geo2.ST_Dimension() AND geometry-expression.ST_Intersection( geo2 ).ST_Dimension() = geometry-expression.ST_Dimension() AND geometry-expression.ST_Covers( geo2 ) = 0 AND geo2.ST_Covers( geometry-expression ) = 0
5.1.32
The following returns the result 1 since the intersection of the two linestrings is also a linestring, and neither geometry is a subset of the other.
SELECT NEW ST_LineString( 'LineString( 0 0, 5 0 )' ) .ST_Overlaps( NEW ST_LineString( 'LineString( 2 0, 3 0, 3 3 )' ) )
The following returns the result NULL since the linestring and point have different dimension.
SELECT NEW ST_LineString( 'LineString( 0 0, 5 0 )' ) .ST_Overlaps( NEW ST_Point( 1, 0 ) )
The following returns the result 0 since the point is a subset of the multipoint.
SELECT NEW ST_MultiPoint( 'MultiPoint(( 2 3 ), ( 1 0 ))' ) .ST_Overlaps( NEW ST_Point( 1, 0 ) )
The following returns the result 24,25,28,31, which is the list of ShapeIDs that overlap the specified polygon.
SELECT LIST( ShapeID ORDER BY ShapeID ) FROM SpatialShapes WHERE Shape.ST_Overlaps( NEW ST_Polygon( 'Polygon(( -1 0, 0 0, 0 1, -1 1, -1 0 ))' ) ) = 1