类别:

地理空间函数

H3_CELL_TO_BOUNDARY

返回表示 H3 单元格边界的 GEOGRAPHY 对象。

语法

H3_CELL_TO_BOUNDARY( <cell_id> )
Copy

实参

cell_id

表示 H3 单元格 ID(索引 (https://h3geo.org/docs/core-library/h3Indexing))的 INTEGER,或表示十六进制格式的单元格 ID 的 VARCHAR。

返回

返回 GEOGRAPHY 对象,代表具有指定 ID 的 H3 单元格的边界。

示例

以下示例返回 GEOGRAPHY 对象,表示包含勃兰登堡门的 H3 单元格的边界。该示例将 H3 单元格 ID 指定为 INTEGER 值。

SELECT H3_CELL_TO_BOUNDARY(613036919424548863);
Copy
+-----------------------------------------+
| H3_CELL_TO_BOUNDARY(613036919424548863) |
|-----------------------------------------|
| {                                       |
|   "coordinates": [                      |
|     [                                   |
|       [                                 |
|         1.337146281884266e+01,          |
|         5.251934565725256e+01           |
|       ],                                |
|       [                                 |
|         1.336924966147084e+01,          |
|         5.251510220405509e+01           |
|       ],                                |
|       [                                 |
|         1.337455447449988e+01,          |
|         5.251214028989955e+01           |
|       ],                                |
|       [                                 |
|         1.338207263166664e+01,          |
|         5.251342164903257e+01           |
|       ],                                |
|       [                                 |
|         1.338428664751681e+01,          |
|         5.251766506194694e+01           |
|       ],                                |
|       [                                 |
|         1.337898164779325e+01,          |
|         5.252062715603375e+01           |
|       ],                                |
|       [                                 |
|         1.337146281884266e+01,          |
|         5.251934565725256e+01           |
|       ]                                 |
|     ]                                   |
|   ],                                    |
|   "type": "Polygon"                     |
| }                                       |
+-----------------------------------------+

以下示例将 H3 单元格 ID 的十六进制值指定为 VARCHAR,以返回与上一示例相同的坐标。

SELECT H3_CELL_TO_BOUNDARY('881F1D4887FFFFF');
Copy
+----------------------------------------+
| H3_CELL_TO_BOUNDARY('881F1D4887FFFFF') |
|----------------------------------------|
| {                                      |
|   "coordinates": [                     |
|     [                                  |
|       [                                |
|         1.337146281884266e+01,         |
|         5.251934565725256e+01          |
|       ],                               |
|       [                                |
|         1.336924966147084e+01,         |
|         5.251510220405509e+01          |
|       ],                               |
|       [                                |
|         1.337455447449988e+01,         |
|         5.251214028989955e+01          |
|       ],                               |
|       [                                |
|         1.338207263166664e+01,         |
|         5.251342164903257e+01          |
|       ],                               |
|       [                                |
|         1.338428664751681e+01,         |
|         5.251766506194694e+01          |
|       ],                               |
|       [                                |
|         1.337898164779325e+01,         |
|         5.252062715603375e+01          |
|       ],                               |
|       [                                |
|         1.337146281884266e+01,         |
|         5.251934565725256e+01          |
|       ]                                |
|     ]                                  |
|   ],                                   |
|   "type": "Polygon"                    |
| }                                      |
+----------------------------------------+
语言: 中文