Skip to main content
return the result of H3 function gridDisk(cell, k). K means the distance of the origin index, gridDisk(cell, k) return cells with distance <=k from the original cell. exactRing : Boolean, when set to true, sedona will remove the result of gridDisk(cell, k-1) from the original results, means only keep the cells with distance exactly k from the original cell

Signatures

ST_H3KRing(cell: Long, k: Int, exactRing: Boolean)

Parameters

cell
Long
required
The cell value.
k
Integer
required
The k value.
exactRing
Boolean
required
The exact ring value.

Return type

An integer value.

Example

SELECT ST_H3KRing(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[0], 1, true) cells union select ST_H3KRing(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[0], 1, false) cells
+--------------------------------------------------------------------------------------------------------------------------------------------+
|cells                                                                                                                                       |
+--------------------------------------------------------------------------------------------------------------------------------------------+
|[614552597293957119, 614552609329512447, 614552609316929535, 614552609327415295, 614552609287569407, 614552597289762815]                    |
|[614552609325318143, 614552597293957119, 614552609329512447, 614552609316929535, 614552609327415295, 614552609287569407, 614552597289762815]|
+--------------------------------------------------------------------------------------------------------------------------------------------+
ST_H3KRing