ST_Contains

Determine whether the first specified geometry contains the second geometry.

ST_Contains does the reverse of ST_Within.

All coordinate systems are treated as being Cartesian.

Syntax

ST_Contains(geo1, geo2);
geo1
The first input geometry.

Type: VARCHAR(ANY)

geo2
The second input geometry.

Type: VARCHAR(ANY)

Returns

A value of type BOOL that is TRUE if the first geometry contains the second geometry; otherwise FALSE.

Examples

SELECT inza..ST_Contains(inza..ST_WKTToSQL('POLYGON ((0 0, 11 0, 11 11, 0 11, 0 0))'),
            inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))'));

ST_CONTAINS
-------------
f
(1 row)
SELECT inza..ST_Contains(inza..ST_WKTToSQL('POLYGON ((0 0, 110 0, 110 110, 0 110, 0 0))'),
            inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))'));

ST_CONTAINS
-------------
t
(1 row)