Index inspection¶
Inspect, validate, and convert H3 indexes.
get_resolution¶
Return the resolution, from 0 through 15, of a cell, directed edge, or
vertex index.
import polars as pl
import polars_h3 as plh3
df = pl.DataFrame({"cell": ["85283473fffffff"]})
df.select(resolution=plh3.get_resolution("cell"))
str_to_int¶
Parse hexadecimal H3 strings as UInt64. Invalid strings produce null.
import polars as pl
import polars_h3 as plh3
df = pl.DataFrame({"cell": ["85283473fffffff"]})
df.select(cell_int=plh3.str_to_int("cell"))
shape: (1, 1)
┌────────────────────┐
│ cell_int │
│ --- │
│ u64 │
╞════════════════════╡
│ 599686042433355775 │
└────────────────────┘
int_to_str¶
Format integer H3 indexes as canonical hexadecimal strings.
import polars as pl
import polars_h3 as plh3
df = pl.DataFrame(
{"cell": [599686042433355775]}, schema={"cell": pl.UInt64}
)
df.select(cell_str=plh3.int_to_str("cell"))
shape: (1, 1)
┌─────────────────┐
│ cell_str │
│ --- │
│ str │
╞═════════════════╡
│ 85283473fffffff │
└─────────────────┘
is_valid_cell¶
Return whether each value is a valid H3 cell.
import polars as pl
import polars_h3 as plh3
df = pl.DataFrame({"cell": ["85283473fffffff", "invalid"]})
df.select(valid=plh3.is_valid_cell("cell"))
is_pentagon¶
Return whether each valid cell is one of H3's 12 pentagons.
import polars as pl
import polars_h3 as plh3
df = pl.DataFrame(
{"cell": [599686042433355775, 599119489002373119]},
schema={"cell": pl.UInt64},
)
df.select(pentagon=plh3.is_pentagon("cell"))
shape: (2, 1)
┌──────────┐
│ pentagon │
│ --- │
│ bool │
╞══════════╡
│ false │
│ true │
└──────────┘
is_res_class_III¶
Return whether each cell uses a Class III resolution.
import polars as pl
import polars_h3 as plh3
df = pl.DataFrame(
{"cell": ["85283473fffffff", "8428347ffffffff"]}
)
df.select(class_iii=plh3.is_res_class_III("cell"))
shape: (2, 1)
┌───────────┐
│ class_iii │
│ --- │
│ bool │
╞═══════════╡
│ true │
│ false │
└───────────┘
get_icosahedron_faces¶
Return the icosahedron face numbers intersected by each cell.
import polars as pl
import polars_h3 as plh3
df = pl.DataFrame({"cell": ["85283473fffffff"]})
df.select(faces=plh3.get_icosahedron_faces("cell"))
For parent/child and compaction operations, see Hierarchy.