CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-h3

Python bindings for H3, a hierarchical hexagonal geospatial indexing system

84

0.95x
Overview
Eval results
Files

task.mdevals/scenario-1/

Directed Edge Toolkit

Utilities for building and inspecting directional links between neighboring hexagonal cells.

Capabilities

Build directed edges from adjacent cells

  • Given an origin cell and three neighbor cells from the same resolution, returns three directed edge identifiers in the input order; each edge connects the origin to the corresponding destination. @test
  • If any destination is not an immediate neighbor of the origin, raises ValueError and yields no edges. @test

Map edges back to endpoints

  • Given two directed edges built from an origin to different neighbors, returns pairs of origin/destination cells matching each edge in order. @test

Edge boundaries follow direction

  • Given a directed edge and the reverse edge between the same two cells, returns boundary coordinates where the first tuple aligns with the origin side and reversing the edge flips the boundary order. @test

Implementation

@generates

API

from typing import List, Tuple

Cell = str
LatLng = Tuple[float, float]
Boundary = Tuple[LatLng, ...]

def build_directed_edges(origin: Cell, destinations: List[Cell]) -> List[str]:
    """Return directed edge identifiers from origin to each destination, validating adjacency and resolution consistency."""

def map_edge_endpoints(edges: List[str]) -> List[Tuple[Cell, Cell]]:
    """Return origin/destination tuples for each edge in input order."""

def edge_boundaries(edges: List[str]) -> List[Boundary]:
    """Return boundary coordinate tuples per edge, ordered from origin toward destination."""

Dependencies { .dependencies }

h3 { .dependency }

Provides directed-edge construction, adjacency checks, endpoint extraction, and boundary coordinates for hexagonal cells.

Install with Tessl CLI

npx tessl i tessl/pypi-h3

tile.json