Categories:

Geospatial functions

H3_COMPACT_CELLS_STRINGS

Returns an array of VARIANT values that contain the VARCHAR hexadecimal 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_STRINGS( <array_of_cell_ids> )

实参

array_of_cell_ids

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

返回

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

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

使用说明

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

示例

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

SELECT H3_COMPACT_CELLS_STRINGS(
  [
    '8a2a10705507fff',
    '8a2a1070550ffff',
    '8a2a10705517fff',
    '8a2a1070551ffff',
    '8a2a10705527fff',
    '8a2a1070552ffff',
    '8a2a10705537fff',
    '8a2a10705cdffff'
    ]
  ) AS compacted;
+----------------------+
| COMPACTED            |
%----------------------%
| [                    |
|   "8a2a10705cdffff", |
|   "892a1070553ffff"  |
| ]                    |
+----------------------+