Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Spatial Data Support » Spatial types and functions » ST_Geometry type

ST_Overlaps method

Tests if a geometry value overlaps another geometry value.

Syntax
geometry-expression.ST_Overlaps(geo2)
Parameters
Name Type Description

geo2

ST_Geometry

The other geometry value that is to be compared to the geometry-expression.

Returns
  • BIT

    Returns 1 if the geometry-expression overlaps geo2, otherwise 0. Returns NULL if geometry-expression and geo2 have different dimensions.

Remarks

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
Note If the geometry-expression contains circularstrings, then these are interpolated to line strings.
Note This method cannot be used with geometries in round-Earth spatial reference systems.
Standards
  • SQL/MM (ISO/IEC 13249-3: 2006)

    5.1.32

Example

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