ST_CONTAINS
functionsupportedCore SQL functionsReturns TRUE if a GEOGRAPHY or GEOMETRY object is completely inside another object of the same type. More strictly, object g1 contains object g2 if and only if no points of g2 lie in the exterior of g1, and at least one point of the interior of B lies in the interior of A. There are certain subtleties in this definition that are not immediately obvious. For more details on what “contains” means, see the Dimensionally Extended 9-Intersection Model (DE-9IM). Although ST_COVERS and ST_CONTAINS might seem similar, the two functions have subtle differences. For details on the differences between “covers” and “contains”, see the Dimensionally Extended 9-Intersection Model (DE-9IM). Note This function does not support using a GeometryCollection or FeatureCollection as input values. Tip You can use the search optimization service to improve the performance of queries that call this function. For details, see Search optimization service.
Syntax
ST_CONTAINS( <geography_expression_1> , <geography_expression_2> )
ST_CONTAINS( <geometry_expression_1> , <geometry_expression_2> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_expression_1 | required | A GEOGRAPHY object that is not a GeometryCollection or FeatureCollection. |
geography_expression_2 | required | A GEOGRAPHY object that is not a GeometryCollection or FeatureCollection. |
geometry_expression_1 | required | A GEOMETRY object that is not a GeometryCollection or FeatureCollection. |
geometry_expression_2 | required | A GEOMETRY object that is not a GeometryCollection or FeatureCollection. |
Returns
BOOLEAN.
Usage notes
- For GEOMETRY objects, the function reports an error if the two input GEOMETRY objects have different SRIDs.