ST_Covers
Signature
BOOLEAN ST_Covers(GEOMETRY geomA, GEOMETRY geomB);
Description
Returns TRUE if no point in geomB is outside geomA.
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_Covers(smallc, smallc) FROM input_table;
-- Answer: TRUE
SELECT ST_Covers(smallc, bigc) FROM input_table;
-- Answer: FALSE
SELECT ST_Covers(bigc, smallc) FROM input_table;
-- Answer: TRUE
SELECT ST_Covers(bigc, ST_ExteriorRing(bigc)) FROM input_table;
-- Answer: TRUE
SELECT ST_Contains(bigc, ST_ExteriorRing(bigc)) FROM input_table;
-- Answer: FALSE