~

更新时间:
复制 MD 格式

Returns true if the bounding box of object A contains that of object B.

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

Parameter

Description

A

A GeomGrid, H3Grid, or Geometry object.

B

A GeomGrid, H3Grid, or Geometry object.

Return value

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

Usage notes

  • Before comparing bounding boxes, GeomGrid and H3Grid objects are converted to Geometry objects.

  • GeomGrid converts to Geometry using SRID 4490 (CGCS2000) by default.

  • H3Grid converts to Geometry using SRID 4326 (WGS84) by default.

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