ST_CoveredBy
Signature
BOOLEAN ST_CoveredBy(GEOMETRY geomA, GEOMETRY geomB);
Description
Returns TRUE if geomA is covered by geomB according the following definitions :
Every point of this geometry is a point of the other geometry.
The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns:
[T*F**F***]
[*TF**F***]
[**FT*F***]
[**F*TF***]
Warning
This predicate does not yet support spatial indices, but it will in a future release. Use it in conjunction with && operator. See here for more details.
Warning
Operation on mixed SRID geometries is not supported
Examples
smallc POLYGON |
bigc POLYGON |
|---|---|
POLYGON((1 1, 5 1, 5 4, 1 4, 1 1)) |
POLYGON((0 0, 10 0, 10 5, 0 5, 0 0)) |

SELECT ST_CoveredBy(smallc, smallc) FROM input_table;
-- Answer: TRUE
SELECT ST_CoveredBy(smallc, bigc) FROM input_table;
-- Answer: TRUE
SELECT ST_CoveredBy(bigc, smallc) FROM input_table;
-- Answer: FALSE
SELECT ST_CoveredBy(bigc, ST_ExteriorRing(bigc)) FROM input_table;
-- Answer: FALSE