Returns the parent grid of an H3-encoded geographic grid at the specified level.
Syntax
h3grid ST_Parent(h3grid code, integer level);Parameters
| Parameter | Description |
|---|---|
code | The H3-encoded geographic grid object. |
level | The target level. Defaults to one level above the level of the input grid. |
Examples
Get the parent grid at the default level (one level up):
SELECT ST_AsText(ST_Parent(ST_H3FromText('884a126689fffff')));Output:
st_astext
-----------------
874a12668ffffffGet the parent grid at level 2:
SELECT ST_AsText(ST_Parent(ST_H3FromText('884a126689fffff'), 2));Output:
st_astext
-----------------
824a17fffffffff