Categories:

Geospatial functions

H3_COMPACT_CELLS

Returns an array of VARIANT values that contain the INTEGER IDs of fewer, larger H3 cells that cover the same area as the H3 cells in the input. For information about compacted cells, see Indexing (https://h3geo.org/docs/highlights/indexing/).

语法

H3_COMPACT_CELLS( <array_of_cell_ids> )

实参

array_of_cell_ids

An array of VARIANT values that contain the INTEGER values that represent H3 cell IDs (indexes (https://h3geo.org/docs/core-library/h3Indexing)).

返回

返回 ARRAY 数据类型的值或 NULL。

  • If the input is an array of INTEGER values, returns an array that consists of VARIANT values that represent a compacted set of H3 cells. The VARIANT values contain the INTEGER values that represent H3 cell IDs.
  • 如果输入为 NULL,则返回 NULL,不报错。

使用说明

  • 输入中的所有 INTEGER 值必须代表有效的 H3 单元格。
  • 输入中的所有 H3 单元必须具有相同的分辨率。
  • 输入中的 H3 单元格必须覆盖独特的区域且不重叠。不允许重复的 H3 单元格。

示例

以下示例压缩了一组 H3 单元格,返回代表相同区域的较低分辨率的单元格。

SELECT H3_COMPACT_CELLS(
  [
    622236750562230271,
    622236750562263039,
    622236750562295807,
    622236750562328575,
    622236750562361343,
    622236750562394111,
    622236750562426879,
    622236750558396415
  ]
) AS compacted;
+-----------------------+
| COMPACTED             |
%-----------------------%
| [                     |
|   622236750558396415, |
|   617733150935089151  |
| ]                     |
+-----------------------+