Name

ST_Covers — Tests if a Geometry A spatially covers another Geometry B.

Synopsis

boolean ST_Covers(bytea GeomA, bytea GeomB);

Alias

Covers

Description

Tests if a Geometry A spatially covers another Geometry B, returns TRUE if so. The covers predicate has the following equivalent definitions:

  • Geometry A covers Geometry B iff no points of B lie in the exterior of A.

  • Every point of B is a point of A.

  • The DE-9IM Intersection Matrix for the two geometries is T*****FF* or *T****FF* or ***T**FF* or ****T*FF*

[Note]

The reverse function of ST_Covers is ST_CoveredBy

[Caution]

This method does not support GeometryCollection arguments

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

SELECT ST_Contains(PolyA,LineB), ST_ContainsProperly(PolyA,LineB),ST_Covers(PolyA,LineB) from 
 (SELECT ST_GeomFromText('POLYGON ((10 30, 6 15, 30 20, 30 30, 20 40, 10 30))') as PolyA, 
         ST_GeomFromText('LINESTRING (10 30, 15 35)') as LineB) as foo;

 st_contains | st_containsproperly | st_covers
-------------+---------------------+-----------
 f           | f                   | t
ST_Contains(PolyA,LineB) = FALSE
ST_ContainsProperly = FALSE
ST_Covers = TRUE

Related functions

ST_Contains,ST_ContainsProperly, ST_CoveredBy, ST_Relate