Vous êtes sur la page 1sur 2

PostGIS 1.5.

1 Manual
176 / 315

7.8.8 ST_CoveredBy
Name
ST_CoveredBy Returns 1 (TRUE) if no point in Geometry/Geography A is outside Geometry/Geography B

Synopsis
boolean ST_CoveredBy(geometry geomA, geometry geomB);
boolean ST_CoveredBy(geography geogA, geography geogB);

Description
Returns 1 (TRUE) if no point in Geometry/Geography A is outside Geometry/Geography B
Performed by the GEOS module

Important
Do not call with a GEOMETRYCOLLECTION as an argument

Important
Do not use this function with invalid geometries. You will get unexpected results.

Availability: 1.2.2 - requires GEOS >= 3.0


This function call will automatically include a bounding box comparison that will make use of any indexes that are available on
the geometries. To avoid index use, use the function _ST_CoveredBy.
NOTE: this is the "allowable" version that returns a boolean, not an integer.
Not an OGC standard, but Oracle has it too.
There are certain subtleties to ST_Contains and ST_Within that are not intuitively obvious. For details check out Subtleties of
OGC Covers, Contains, Within

Examples
--a circle coveredby a circle
SELECT ST_CoveredBy(smallc,smallc) As smallinsmall,
ST_CoveredBy(smallc, bigc) As smallcoveredbybig,
ST_CoveredBy(ST_ExteriorRing(bigc), bigc) As exteriorcoveredbybig,
ST_Within(ST_ExteriorRing(bigc),bigc) As exeriorwithinbig
FROM (SELECT ST_Buffer(ST_GeomFromText(POINT(1 2)), 10) As smallc,
ST_Buffer(ST_GeomFromText(POINT(1 2)), 20) As bigc) As foo;
--Result
smallinsmall | smallcoveredbybig | exteriorcoveredbybig | exeriorwithinbig
--------------+-------------------+----------------------+-----------------t
| t
| t
| f
(1 row)

PostGIS 1.5.1 Manual


177 / 315

See Also
ST_Contains, ST_Covers, ST_ExteriorRing, ST_Within

7.8.9 ST_Crosses
Name
ST_Crosses Returns TRUE if the supplied geometries have some, but not all, interior points in common.

Synopsis
boolean ST_Crosses(geometry g1, geometry g2);

Description
ST_Crosses takes two geometry objects and returns TRUE if their intersection "spatially cross", that is, the geometries have
some, but not all interior points in common. The intersection of the interiors of the geometries must not be the empty set and
must have a dimensionality less than the the maximum dimension of the two input geometries. Additionally, the intersection of
the two geometries must not equal either of the source geometries. Otherwise, it returns FALSE.
In mathematical terms, this is expressed as:

The DE-9IM Intersection Matrix for the two geometries is:


T*T****** (for Point/Line, Point/Area, and Line/Area situations)
T*****T** (for Line/Point, Area/Point, and Area/Line situations)
0******** (for Line/Line situations)
For any other combination of dimensions this predicate returns false.
The OpenGIS Simple Features Specification defines this predicate only for Point/Line, Point/Area, Line/Line, and Line/Area
situations. JTS / GEOS extends the definition to apply to Line/Point, Area/Point and Area/Line situations as well. This makes
the relation symmetric.

Important
Do not call with a GEOMETRYCOLLECTION as an argument

Note
This function call will automatically include a bounding box comparison that will make use of any indexes that are
available on the geometries.

This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1. s2.1.13.3
This method implements the SQL/MM specification. SQL-MM 3: 5.1.29

Vous aimerez peut-être aussi