Categories:

Geospatial functions

H3_CELL_TO_POINT

Returns the GEOGRAPHY object representing the Point that is the centroid of an H3 cell.

See also:

H3_POINT_TO_CELL , H3_POINT_TO_CELL_STRING

语法

H3_CELL_TO_POINT( <cell_id> )

实参

cell_id

An INTEGER that represents the H3 cell ID (index (https://h3geo.org/docs/core-library/h3Indexing)), or a VARCHAR that represents the cell ID in hexadecimal format.

返回

返回点的 GEOGRAPHY 对象,该对象表示具有指定 ID 的 H3 单元格的质心。

示例

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

SELECT H3_CELL_TO_POINT(613036919424548863);
+--------------------------------------+
| H3_CELL_TO_POINT(613036919424548863) |
%--------------------------------------%
| {                                    |
|   "coordinates": [                   |
|     1.337676791184706e+01,           |
|     5.251638386722465e+01            |
|   ],                                 |
|   "type": "Point"                    |
| }                                    |
+--------------------------------------+

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

SELECT H3_CELL_TO_POINT('881F1D4887FFFFF');
+-------------------------------------+
| H3_CELL_TO_POINT('881F1D4887FFFFF') |
%-------------------------------------%
| {                                   |
|   "coordinates": [                  |
|     1.337676791184706e+01,          |
|     5.251638386722465e+01           |
|   ],                                |
|   "type": "Point"                   |
| }                                   |
+-------------------------------------+