ST_Contains
Signatures
Description
Returns true if geomA
contains geomB
.
Implements the OpenGIS Simple Features Implementation Specification for SQL version 1.2.1.
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.
Examples
Cases where ST_Contains
is true
geomA POLYGON | geomB POLYGON |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | POLYGON((2 2, 7 2, 7 5, 2 5, 2 2)) |
geomA POLYGON | geomB POLYGON |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | POLYGON((1 2, 6 2, 6 5, 1 5, 1 2)) |
geomA POLYGON | geomB LINESTRING |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | LINESTRING(2 6, 6 2) |
geomA POLYGON | geomB LINESTRING |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | LINESTRING(1 2, 1 6, 5 2) |
geomA POLYGON | geomB POINT |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | POINT(4 4) |
geomA LINESTRING | geomB LINESTRING |
---|---|
LINESTRING(2 1, 5 3, 2 6) | LINESTRING(3 5, 5 3) |
geomA LINESTRING | geomB POINT |
---|---|
LINESTRING(2 1, 5 3, 2 6) | POINT(4 4) |
Cases where ST_Contains
is false
geomA POLYGON | geomB POLYGON |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | POLYGON((0 2, 5 2, 5 5, 0 5, 0 2)) |
geomA POLYGON | geomB LINESTRING |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | LINESTRING(2 6, 0 8) |
geomA POLYGON | geomB LINESTRING |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | LINESTRING(1 2, 1 6) |
geomA POLYGON | geomB POINT |
---|---|
POLYGON((1 1, 8 1, 8 7, 1 7, 1 1)) | POINT(8 4) |
geomA POLYGON | geomB POINT |
---|---|
POLYGON((1 1, 7 1, 7 7, 1 7, 1 1)) | POINT(8 4) |