Ctrl + K
DocumentationLog inGet started

tessl/pypi-h3

tessl install tessl/pypi-h3@4.3.0

Python 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%

task.mdevals/scenario-2/

Hex Cell Mapper

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.

Capabilities

Encode points to cell ids

  • Converting (37.7749, -122.4194) at resolution 9 returns the hex cell identifier 89283082e6bffff. @test
  • The same coordinate encoded at resolution 7 returns a different valid identifier than the resolution 9 result. @test

Decode cell centers

  • Fetching the center coordinate of 89283082e6bffff and re-encoding that center at resolution 9 yields the same identifier. @test

Cell boundary polygon

  • Retrieving the boundary for 89283082e6bffff returns six vertices in counterclockwise order whose polygon contains (37.7749, -122.4194). @test

Implementation

@generates

API

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."""

Dependencies { .dependencies }

h3 { .dependency }

Provides hexagonal indexing for latitude/longitude conversion, cell centers, and cell boundaries.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/h3@4.3.x
tile.json