@ / />

更新时间:
复制 MD 格式

Checks whether a grid contains a geometry or another grid, and returns a boolean result.

Syntax

boolean @>(geomgrid grid, geometry geom);
boolean @>(geometry geom, geomgrid grid);
boolean @>(geomgrid grid1, geomgrid grid2);

Parameters

ParameterDescription
gridThe grid whose spatial relationship you want to query.
geomThe geometry whose spatial relationship you want to query.

Usage notes

The geometry must use the CGC2000 spatial reference system. The Spatial Reference System Identifier (SRID) of the geometry must be 4490.

Examples

The following examples demonstrate containment checks between a grid and a point geometry, and between two grids. The first query returns f because the point falls outside the target grid. The second query returns t because the second grid is fully contained within the first.

-- Grid does not contain the point (returns f)
SELECT ST_gridfromtext('G001331032213300013') @>
       ST_geomfromtext('POINT(116.31522216796875 39.910277777777778)', 4490) AS result;

 result
--------
 f

-- Larger grid contains the smaller grid (returns t)
SELECT ST_gridfromtext('G00133103221330') @>
       ST_gridfromtext('G001331032213300013') AS result;

 result
--------
 t