Return the center child of an H3 cell at a finer resolution.
H3_CELL_TO_CENTER_CHILD(cell, resolution)
## Overview Returns the single child cell at a finer resolution whose center is nearest to the center of the input cell. In the H3 hierarchy, a parent cell at resolution N contains 7 children at resolution N+1 (6 at pentagon cells), and typically 7^k children at resolution N+k. This function picks out the one child whose center aligns with the parent center, which is useful for sampling, downsampling, and building consistent coarse-to-fine lookup tables. Use this when you need a stable, deterministic representative child, for example when linking a coarse aggregate to a finer-grained sample cell, or when rendering a hierarchical grid and you want to walk the center chain. ## Behavior - Returns a BIGINT cell ID at the target resolution. - Returns NULL if the target resolution is coarser than or equal to the input cell's resolution. - Returns NULL if the target resolution is outside [0, 15] or if the input cell is NULL or invalid. - At Class III resolutions (odd resolutions), the center child is not exactly geometrically centered because Class III cells are rotated relative to their parent; it is still the cell whose center lies closest to the parent center. - The hierarchy is deterministic: applying H3_CELL_TO_CENTER_CHILD repeatedly walks a stable center chain down through the resolutions. - Each level finer multiplies the total descendant count by 7 (6 for pentagon children). ## H3 resolution reference | Res | Average edge length | Average hex area | | --- | --- | --- | | 0 | 1,107 km | 4.25 million km^2 | | 7 | 1.22 km | 5.16 km^2 | | 9 | 174 m | 0.11 km^2 | | 12 | 9.4 m | 307 m^2 | | 15 | 0.5 m | 0.9 m^2 | ## Compatibility - Follows the standard H3 hierarchical hex grid specification for parent-child navigation.
| Name | Type | Description |
|---|---|---|
cell | Specifies the parent H3 cell index whose center child to return. Must be a valid H3 cell. | |
resolution | Specifies the target finer resolution. Valid values are integers from the parent's resolution + 1 through 15. Resolutions that are coarser than or equal to the parent's resolution return NULL. |
-- Resolution 7 cell -> its center child at resolution 8.
SELECT H3_CELL_TO_CENTER_CHILD(H3_LATLNG_TO_CELL(40.7128, -74.0060, 7), 8) AS center_child;
-- Resolution 4 cell -> its center child at resolution 6 (one of 49 possible children).
SELECT H3_CELL_TO_CENTER_CHILD(H3_LATLNG_TO_CELL(48.8566, 2.3522, 4), 6) AS center_child;
-- Build a coarse-to-fine sampling lookup: every resolution 5 cell's deep center at resolution 10.
SELECT
parent_cell,
H3_CELL_TO_CENTER_CHILD(parent_cell, 10) AS sample_cell_res10
FROM spatial.reference.h3_grid_res5;
-- Cell centers are within one child-cell's edge of each other.
SELECT
H3_CELL_TO_LAT(parent) AS parent_lat,
H3_CELL_TO_LAT(H3_CELL_TO_CENTER_CHILD(parent, 10)) AS child_lat,
H3_CELL_TO_LNG(parent) AS parent_lng,
H3_CELL_TO_LNG(H3_CELL_TO_CENTER_CHILD(parent, 10)) AS child_lng
FROM (SELECT H3_LATLNG_TO_CELL(51.5074, -0.1278, 7) AS parent);