ST_ContainsProperly — Tests if a Geometry A spatially contains properly another Geometry B.
boolean ST_ContainsProperly(bytea GeomA, bytea GeomB);
Tests if a Geometry A spatially contains properly another Geometry B, returns TRUE if so. The ST_ContainsProperly predicate has the following equivalent definitions:
Geometry A containsProperly Geometry B iff all points of B lie in the interior of A.
The DE-9IM Intersection Matrix for the two geometries matches [T**FF*FF*]
![]() | |
This method does not support GeometryCollection arguments |
| 2D | 3D | M |
|---|---|---|
![]() | ![]() | ![]() |
| OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
|---|---|---|---|
| - | - | - | - |
SELECT ST_Contains(Polygon,Polygon),ST_ContainsProperly(Polygon,Polygon) from
(SELECT ST_GeomFromText('POLYGON ((10 30, 0 10, 30 20, 30 30, 20 40, 10 30))') as Polygon) as foo;
st_contains | st_containsproperly
-------------+---------------------
t | f
SELECT ST_ContainsProperly(LineA,LineB) from
(SELECT ST_GeomFromText('LINESTRING (40 50, 120 90, 200 90)') as LineA,
ST_GeomFromText('LINESTRING (120 90, 180 90)') as LineB) as foo;
st_containsproperly
---------------------
tST_ContainsProperly(A,B) returns True in the following situations
![]() | ![]() | ![]() |
ST_ContainsProperly(A,B) returns False in the following situations
![]() | ![]() | ![]() |