Categories:

Geospatial functions

H3_POINT_TO_CELL_STRING

Returns the hexadecimal value of an H3 cell ID for a Point (specified by a GEOGRAPHY object) at a given resolution.

See also:

H3_POINT_TO_CELL , H3_CELL_TO_POINT

语法

H3_POINT_TO_CELL_STRING( <geography_point> , <target_resolution> )

实参

geography_point

表示一个点的 GEOGRAPHY 对象。

target_resolution

An INTEGER between 0 and 15 (inclusive) that specifies the H3 resolution (https://h3geo.org/docs/core-library/restable) that you want to use for the returned H3 cell.

指定其他任何 INTEGER 值都会导致错误。

返回

返回与给定位置和分辨率的十六进制 H3 单元格 ID 相对应的 VARCHAR 值。

示例

以下示例以分辨率 8 返回勃兰登堡门的十六进制 H3 单元格 ID。

SELECT H3_POINT_TO_CELL_STRING(ST_POINT(13.377704, 52.516262), 8);
+------------------------------------------------------------+
| H3_POINT_TO_CELL_STRING(ST_POINT(13.377704, 52.516262), 8) |
%------------------------------------------------------------%
|  881F1D4887FFFFF                                           |
+------------------------------------------------------------+

下面的示例演示您不能指定 0 到 15 之外的分辨率。

SELECT H3_POINT_TO_CELL_STRING(ST_POINT(13.377704, 52.516262), 18);
100410 (P0000): Invalid H3 resolution value: 18. Resolution must be between 0 (coarsest) and 15 (finest).