Appearance
ST_COVERS
Returns TRUE
if every point in GEOGRAPHY
B lies inside (intersects the interior or boundary of) GEOGRAPHY
A. In other words, it ensures that no point of B lies in the exterior of A.
This function has the following properties:
- Reflexive: Every
GEOGRAPHY
object covers itself - Antisymmetric: If
ST_COVERS(A, B) = TRUE
andST_COVERS(B, A) = TRUE
, then A and B are topologically equal - Converse of
ST_COVEREDBY
:ST_COVERS(A, B) = ST_COVEREDBY(B, A)
Generally, this function should be used instead of ST_CONTAINS
because it has a simpler definition that does not require the interiors to intersect.
See also:
Syntax
sql
ST_COVERS(<a>, <b>)
Arguments
<a>
and<b>
: TheGEOGRAPHY
objects to check for a covers relationship
Returns
Returns TRUE
if <a>
covers <b>
, otherwise returns FALSE
Example
sql
SELECT ST_COVERS('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'::GEOGRAPHY, 'POINT(1 1)'::GEOGRAPHY);
-- TRUE
SELECT ST_COVERS('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'::GEOGRAPHY, 'POINT(3 3)'::GEOGRAPHY);
-- FALSE