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. |
grid1 | The grid to test as the containing object (grid-to-grid comparison). |
grid2 | The grid to test as the contained object (grid-to-grid comparison). |
Examples
Example 1: Grid does not contain a point
SELECT ST_Contains(
ST_gridfromtext('G001331032213300013'),
ST_GeomFromText('POINT(116.31522216796875 39.910277777777778)', 4490)
); st_intersects
---------------
fExample 2: Grid contains another grid
SELECT ST_Contains(
ST_gridfromtext('G00133103221330'),
ST_gridfromtext('G001331032213300013')
); st_contains
-------------
t该文章对您有帮助吗?