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_H3Uncompact

Introduction: Expands an array of H3 cell IDs to the requested resolution using H3's uncompactCells(cells, resolution).

The input cells may have different resolutions and do not need to come from a compaction operation. Each coarser cell is replaced by its descendants at the target resolution. Cells already at the target resolution are retained.

The requested resolution must be between 0 and 15, inclusive, and at least as fine as every input cell's resolution. A lower resolution or a resolution outside this range raises an error. An empty input array returns an empty array. A null array or resolution returns null.

Input cells should be unique and non-overlapping; duplicate or overlapping cells may produce duplicates in the output. The order of the returned cells is not guaranteed. The result can grow rapidly when expanding to a much finer resolution.

Format: ST_H3Uncompact(cells: Array<Long>, resolution: Int)

Return type: Array<Long>

Since: v2.0.0

SQL Example

SELECT ST_H3Uncompact(ARRAY[601041811137363967], 5)

Output:

[601041811137363967]

To expand this resolution 5 hexagon to its seven immediate children:

SELECT CARDINALITY(ST_H3Uncompact(ARRAY[601041811137363967], 6)) AS cell_count

Output:

7