geo_h3cell_parent()
Calculates the H3 cell parent.
Read more about H3 Cell.
Syntax
geo_h3cell_parent(h3cell, resolution)
Arguments
- h3cell: H3 Cell token string value as it was calculated by geo_point_to_h3cell().
- resolution: An optional
intthat defines the requested parent cell resolution. Supported values are in the range [0, 14]. If unspecified, an immediate parent will be calculated.
Returns
H3 Cell parent token string. If the H3 Cell is invalid or parent resolution is higher than given cell, the query will produce an empty result.
Examples
print parent_cell = geo_h3cell_parent('862a1072fffffff')
| parent_cell |
|---|
| 852a1073fffffff |
The following calculates cell parent at level 1.
print parent_cell = geo_h3cell_parent('862a1072fffffff', 1)
| parent_cell |
|---|
| 812a3ffffffffff |
print parent_res = geo_h3cell_level(geo_h3cell_parent((geo_point_to_h3cell(1,1,10))))
| parent_res |
|---|
| 9 |
print parent_res = geo_h3cell_level(geo_h3cell_parent(geo_point_to_h3cell(1,1,10), 3))
| parent_res |
|---|
| 3 |
The following example produces an empty result because of the invalid cell input.
print invalid = isempty(geo_h3cell_parent('123'))
| invalid |
|---|
| 1 |
The following example produces an empty result because of the invalid parent resolution.
print invalid = isempty(geo_h3cell_parent('862a1072fffffff', 100))
| invalid |
|---|
| 1 |
The following example produces an empty result because parent can't be of a higher resolution than child.
print invalid = isempty(geo_h3cell_parent('862a1072fffffff', 15))
| invalid |
|---|
| 1 |