Name

ST_ContainsProperly — Tests if a Geometry A spatially contains properly another Geometry B.

Synopsis

boolean ST_ContainsProperly(bytea GeomA, bytea GeomB);

Alias

ContainsProperly

Description

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*]

[Caution]

This method does not support GeometryCollection arguments

Coordinate Dimensions
2D3DM
Spatial Standards Support
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
----

Examples

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
---------------------
 t

ST_ContainsProperly(A,B) returns True in the following situations

LINESTRING - LINESTRING
POLYGON - LINESTRING
POLYGON - POLYGON

ST_ContainsProperly(A,B) returns False in the following situations

POLYGON - POLYGON
POLYGON - LINESTRING
POLYGON - POLYGON

Related functions

ST_Contains, ST_Relate