跳转至
🎉 Apache Sedona 1.9.1 已正式发布!🗺️ 新增 Geography SQL 函数、Box2D 与 Box3D 类型、栅格 Python UDF 等。查看发布说明 →

ST_H3ToCenterChild

Introduction: Returns the center child of an H3 cell at the requested resolution using H3's cellToCenterChild(cell, resolution).

The requested resolution must be between the input cell's resolution and 15, inclusive. An equal resolution returns the input cell. A lower resolution or a resolution outside this range raises an error. A null cell or resolution returns null.

The function returns a single center descendant at the target resolution, including when skipping multiple resolutions. For a pentagon input, the center child is also a pentagon.

Format: ST_H3ToCenterChild(cell: Long, resolution: Int)

Return type: Long

Since: v2.0.0

SQL Example

Find the resolution 6 center child of a resolution 5 hexagon:

SELECT ST_H3ToCenterChild(601041811137363967, 6)

Output:

605545409825210367

An equal resolution retains the input cell:

SELECT ST_H3ToCenterChild(601041811137363967, 5)

Output:

601041811137363967