ST_Contains(A, B) returns true if:
- No point in B lies outside of shape A, and
- At least one point in the interior of B lies in the interior of A.
ST_Covers.
ST_Contains works on the following data types:
ST_Contains will attempt to use any available to speed up its
operation. Use the prefixed variant _ST_Contains 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_Contains returns true because:
- No point in the LineString B lies outside of the Polygon A, and
- At least one point in the interior of B lies in the interior of A.

False
In this example,ST_Contains returns false because:
- At least one point in the interior of LineString B does not lie in the interior of the Polygon A.
true.


