Skip to main content
Given two shapes A and B, the predicate function ST_CoveredBy(A, B) returns true if no point in A lies outside of shape B. Otherwise, it returns false. In other words, shape B must completely cover every point in A. ST_CoveredBy works on the following data types:
ST_CoveredBy will attempt to use any available to speed up its operation. Use the prefixed variant _ST_CoveredBy if you do not want any spatial indexes to be used.
This function is the inverse of .

Examples

The screenshots in these examples were generated using geojson.io, but they are designed to showcase the shapes, not the map. Representing GEOMETRY data in GeoJSON can lead to unexpected results if using geometries with other than 4326 (as shown below).

True

In this example, ST_CoveredBy returns true because:
  • No Point in the smaller Polygon A lies outside of the larger Polygon B.
ST_CoveredBy - true

False

In this example, ST_CoveredBy returns false because:
  • Many Points in the smaller Polygon A lie outside of the larger Polygon B.
ST_CoveredBy - false

See also