ST_Within
Determine whether one geometry is contained completely within another
geometry, that is, whether their DE-9IM intersection matrix is T*F**F***
.
ST_Within is the reverse of ST_Contains. All coordinate systems are treated as being Cartesian.
Syntax
ST_Within(geo1, geo2, cSys);
- geo1
- The first input geometry.
Type: VARCHAR(ANY)
- geo2
- The second input geometry.
Type: VARCHAR(ANY)
- cSys
- The coordinate system of the input geometry.
Type: VARCHAR(ANY)
Default: The coordinate system of the input geometry's SRID or, if the input geometry has no SRID, 'WGS84'.
Returns
A value of type BOOL that is TRUE if the first geometry is completely contained within the second geometry; otherwise FALSE.
Examples
SELECT inza..ST_Within(inza..ST_WKTToSQL('
POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))', 1234), inza..ST_WKTToSQL('
POLYGON ((0 0, 110 0, 110 110, 0 110, 0 0))', 1234));
ST_WITHIN
-----------
t
(1 row)