This topic describes the ST_Within function, which queries whether a grid is contained in a geometry.

Syntax

boolean ST_Within(geomgrid grid, geometry geom);
boolean ST_Within(geometry geom, geomgrid grid);
boolean ST_Within(geomgrid grid1, geomgrid grid2);

Parameters

Parameter Description
grid The grid whose spatial relationship you want to query.
geom The geometry whose spatial relationship you want to query.

Description

This function returns the spatial relationship between a grid and a geometry. The geometry must use the CGC2000 spatial reference system. In addition, the spatial reference system identifier (SRID) of the geometry must be 4490.

Examples

select st_within(ST_geomfromtext('POINT(116.31522216796875 39.910277777777778)',4490),
  ST_gridfromtext('G001331032213300013'));

 st_within 
---------------
 f
 
 select st_within(ST_gridfromtext('G001331032213300013'), 
                  ST_gridfromtext('G001331032213300'))
                    
  st_within 
-------------
 t