Tests if a geometry value spatially covers another geometry value.
geometry-expression.ST_Covers(geo2)
Name | Type | Description |
---|---|---|
geo2 |
ST_Geometry |
The other geometry value that is to be compared to the geometry-expression. |
BIT Returns 1 if the geometry-expression covers geo2, otherwise 0.
The ST_Covers method tests if the geometry-expression completely covers geo2. geometry-expression.ST_Covers( geo2 ) is equivalent to geo2.ST_CoveredBy( geometry-expression ).
This predicate is similar to ST_Contains except for one subtle difference. The ST_Contains predicate requires that one or more interior points of geo2 lie in the interior of the geometry-expression. For ST_Covers(), the method returns 1 if no point of geo2 lies outside of the geometry-expression. Also, ST_Covers can be used with geometries in round-Earth spatial reference systems, while ST_Contains can not.
If the geometry-expression contains circular strings, then these are interpolated to line strings.
SQL/MM (ISO/IEC 13249-3: 2006) Vendor extension
The following example tests if a polygon covers a point. The polygon completely covers the point so the example returns 1.
SELECT NEW ST_Polygon( 'Polygon(( 0 0, 2 0, 1 2, 0 0 ))' ) .ST_Covers( NEW ST_Point( 1, 1 ) ) |
The following example tests if a polygon covers a line. The polygon completely covers the line so the example returns 1. If ST_Contains was used in place of ST_Covers, ST_Contains would return 0.
SELECT NEW ST_Polygon( 'Polygon(( 0 0, 2 0, 1 2, 0 0 ))' ) .ST_Covers( NEW ST_LineString( 'LineString( 0 0, 1 0 )' ) ) |
The following example lists the ShapeIDs where the given polygon covers
each Shape geometry. This example returns the result 1,16,17,19,26
.
Note that ShapeID 1 is listed even though the polygon intersects
that row's Shape point only at the polygon's boundary.
SELECT LIST( ShapeID ORDER BY ShapeID ) FROM SpatialShapes WHERE NEW ST_Polygon( NEW ST_Point( 0, 0 ), NEW ST_Point( 8, 2 ) ).ST_Covers( Shape ) = 1 |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |