geo_h3cell_parent()

Calculates the H3 cell parent.

Read more about H3 Cell.

Syntax

geo_h3cell_parent(h3cell,resolution)

Learn more about syntax conventions.

Parameters

Name Type Required Description
h3cell string ✔️ An H3 Cell token value as it was calculated by geo_point_to_h3cell().
resolution int Defines the requested children cells resolution. Supported values are in the range [0, 14]. If unspecified, an immediate children token 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')

Output

parent_cell
852a1073fffffff

The following example calculates cell parent at level 1.

print parent_cell = geo_h3cell_parent('862a1072fffffff', 1)

Output

parent_cell
812a3ffffffffff
print parent_res = geo_h3cell_level(geo_h3cell_parent((geo_point_to_h3cell(1,1,10))))

Output

parent_res
9
print parent_res = geo_h3cell_level(geo_h3cell_parent(geo_point_to_h3cell(1,1,10), 3))

Output

parent_res
3

The following example produces an empty result because of the invalid cell input.

print invalid = isempty(geo_h3cell_parent('123'))

Output

invalid
1

The following example produces an empty result because of the invalid parent resolution.

print invalid = isempty(geo_h3cell_parent('862a1072fffffff', 100))

Output

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))

Output

invalid
1