tessl install tessl/pypi-h3@4.3.0Python bindings for H3, a hierarchical hexagonal geospatial indexing system
Agent Success
Agent success rate when using this tile
84%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.95x
Baseline
Agent success rate without this tile
88%
Build a small module that turns geographic coordinates into hexagonal cell identifiers at a chosen resolution, returns the center coordinate of a cell, and exposes the cell's boundary polygon for mapping or validation. All coordinates are (lat, lng) in decimal degrees, and cell identifiers use the library's default string form.
89283082e6bffff. @test89283082e6bffff and re-encoding that center at resolution 9 yields the same identifier. @test89283082e6bffff returns six vertices in counterclockwise order whose polygon contains (37.7749, -122.4194). @test@generates
from typing import Iterable, Sequence, Tuple
Point = Tuple[float, float]
Vertex = Tuple[float, float]
def encode_points(points: Iterable[Point], resolution: int) -> list[str]:
"""Return hex cell identifiers for each (lat, lng) point at the given resolution."""
def decode_center(cell: str) -> Point:
"""Return the center (lat, lng) for a hex cell identifier."""
def cell_boundary(cell: str) -> Sequence[Vertex]:
"""Return the ordered boundary vertices (lat, lng) for a hex cell identifier."""Provides hexagonal indexing for latitude/longitude conversion, cell centers, and cell boundaries.