All Products
Search
Document Center

PolarDB:&&

Last Updated:Apr 23, 2024

This operator determines whether the bounding box of a GeomGrid object, an H3Grid object, or a Geometry object intersects with 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 an object intersects with that of another object, 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 intersects with that of another object. If the bounding box of an object intersects with that of another object, 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

--&&(GeomGrid, Geometry)
SELECT COUNT(*) from geomgrid_gist_test WHERE code && 'SRID=4490;POLYGON((80 20,90 20,90 25,80 25,80 20))'::Geometry;

-------
     5

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

-------
     1

--&&(Geometry, H3Grid)
SELECT COUNT(*) from h3grid_gist_test WHERE 'SRID=4490;POLYGON((-70 -20,-60 -20,-60 -10,-70 -10,-70 -20))'::Geometry && code;

-------
     1