Skip to content
πŸŽ‰ Apache Sedona 1.9.1 is out now! πŸ—ΊοΈ Geography SQL functions, Box2D & Box3D types, raster Python UDFs & more. Read the release notes β†’

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