Name

ST_CoveredBy — Tests if a Geometry A is covered by Geometry B.

Synopsis

boolean ST_CoveredBy(bytea GeomA, bytea GeomB);

Alias

CoveredBy

Description

Tests if a Geometry A is covered by Geometry B, returns TRUE if so.

  • Geometry A is covered by Geometry B iff every point of A is a point of B.

  • The DE-9IM Intersection Matrix for the two geometries is [T*F**F***] or [*TF**F***] or [**FT*F***] or [**F*TF***]

[Note]

The reverse function of ST_Covers is ST_CoveredBy [ST_Covers(A,B) =ST_CoveredBy[B,A]

[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_CoveredBy(Polygon,Line) as CoveredByPolygon_Line, 
       ST_CoveredBy(Line,Polygon) CoveredByLine_Polygon,
       ST_Covers(Polygon,Line) as CoversPolygon_Line 
FROM (SELECT ST_GeomFromText('POLYGON ((10 30, 0 10, 30 20, 30 30, 20 40, 10 30))') as Polygon, 
        ST_GeomFromText('LINESTRING (12 22, 16 25, 13 29, 13 29)') as Line) as foo;

 coveredbypolygon_line | coveredbyline_polygon | coverspolygon_line
-----------------------+-----------------------+--------------------
 f                     | t                     | t

Related functions

ST_Covers, ST_Relate