This topic describes the ST_Contains function, which queries whether a grid contains a geometry.

Syntax

boolean ST_Contains(geomgrid grid, geometry geom);
boolean ST_Contains(geometry geom, geomgrid grid);
boolean ST_Contains(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.

Examples

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

 st_intersects 
---------------
 f
 
 select st_contains(ST_gridfromtext('G00133103221330'), 
                    ST_gridfromtext('G001331032213300013'))
                    
  st_contains 
-------------
 t