PolarDB:@

更新时间:
复制 MD 格式

Determines whether the bounding box of a GeomGrid, H3Grid, or Geometry object contains that of another object. GeomGrid and H3Grid objects are converted to Geometry before the comparison.

Syntax

bool @(GeomGrid A, GeomGrid B);
bool @(GeomGrid A, Geometry B);
bool @(Geometry A, GeomGrid B);
bool @(H3Grid A, H3Grid B);
bool @(H3Grid A, Geometry B);
bool @(Geometry A, H3Grid B);

Parameters

ParameterDescription
AA GeomGrid, H3Grid, or Geometry object whose bounding box is tested as the containing object
BA GeomGrid, H3Grid, or Geometry object whose bounding box is tested for containment

Return value

Returns true if the bounding box of A contains the bounding box of B. Returns false otherwise.

Usage notes

  • GeomGrid objects are converted to Geometry using the 4490 coordinate system by default.

  • H3Grid objects are converted to Geometry using the 4326 coordinate system by default.

Examples

`@(GeomGrid, GeomGrid)` — Count rows where the GeomGrid cell contains 'G00':

SELECT COUNT(*) from geomgrid_gist_test WHERE code @ 'G00'::GeomGrid;

-------
     5

`@(GeomGrid, Geometry)` — Count rows where the GeomGrid cell contains the specified polygon:

SELECT COUNT(*) from geomgrid_gist_test WHERE code @ 'SRID=4490;POLYGON((88 24,88.8 24,88.8 24.5,88 24.5,88 24))'::Geometry;

-------
     2

`@(H3Grid, H3Grid)` — Count rows where the H3Grid cell contains another H3Grid cell:

SELECT COUNT(*) from h3grid_gist_test where code @ ST_H3FromLatLng(-17.5, -65.0, 1);

-------
     1

`@(H3Grid, Geometry)` — Count rows where the H3Grid cell contains the specified polygon:

SELECT COUNT(*) from h3grid_gist_test WHERE code @ 'SRID=4490;POLYGON((0 30,5 30,5 38,0 38,0 30))'::Geometry;

-------
     1