This operator determines whether the bounding box of a GeomGrid object, an H3Grid object, or a Geometry object contains that of another object. A GeomGrid object or an H3Grid object is converted into a Geometry object before the operator determines the spatial relationship between the bounding boxes of the two objects.
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);Return values
If the bounding box of object A contains that of object B, the value true is returned. Otherwise, the value false is returned.
Parameters
Parameter | Description |
A | The GeomGrid, H3Grid, or Geometry object. |
B | The GeomGrid, H3Grid, or Geometry object. |
Usage notes
This operator determines whether the bounding box of a GeomGrid object, an H3Grid object, or a Geometry object contains that of another object. If the bounding box of object A contains that of object B, the value true is returned. Otherwise, the value false is returned.
A GeomGrid object or an H3Grid object is converted into a Geometry object before the operator determines the spatial relationship between the bounding boxes of the two objects.
By default, a GeomGrid object is converted into a Geometry object in the 4490 coordinate system.
By default, an H3Grid object is converted into a Geometry object in the 4326 coordinate system.
Examples
--~(GeomGrid, GeomGrid)
SELECT COUNT(*) from geomgrid_gist_test WHERE 'G00'::GeomGrid ~ code;
-------
5
--~(Geometry, GeomGrid)
SELECT COUNT(*) from geomgrid_gist_test WHERE 'SRID=4490;POLYGON((88 24,88.8 24,88.8 24.5,88 24.5,88 24))'::Geometry ~ code;
-------
2
--~(H3Grid, H3Grid)
SELECT COUNT(*) from h3grid_gist_test where code ~ ST_H3FromLatLng(-17.5, -65.0, 1);
-------
0
--~(Geometry, H3Grid)
SELECT COUNT(*) from h3grid_gist_test WHERE 'SRID=4326;POLYGON((0 30,5 30,5 38,0 38,0 30))'::Geometry ~ code;
-------
1