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-9/

Geo Shape Bridging

Transform user-supplied latitude/longitude rings into the library's native polygon containers and back to GeoJSON while preserving holes and multi-shape structure.

Capabilities

Construct polygon with holes

  • Given an outer ring (lat, lng) rectangle and one hole, build_shape returns an object exposing __geo_interface__ whose geometry reports type Polygon with two rings; output coordinates are [lng, lat] and both rings are closed with point counts matching the inputs (plus the closing point). @test

Combine multiple polygons

  • Combining two previously built polygons yields a multi-shape that exposes __geo_interface__ type MultiPolygon where polygon order is preserved and each ring remains closed and intact. @test

GeoJSON round-trip

  • Converting a GeoJSON MultiPolygon with two triangles to a native shape via from_geojson then back via to_geojson returns a GeoJSON dict identical in geometry type and coordinate sequences to the original (respecting [lng, lat] ordering). @test

Reject invalid geometry

  • Passing GeoJSON with an unsupported geometry type raises a ValueError (or equivalent library error) without producing a shape. @test

Implementation

@generates

API

def build_shape(outer: list[tuple[float, float]], holes: list[list[tuple[float, float]]]] | None = None):
    """Create a native polygon shape from an outer ring and optional hole rings; returns an object exposing __geo_interface__."""

def combine_shapes(polygons: list) -> object:
    """Combine multiple polygon-like objects into a native multi-shape that exposes __geo_interface__ and preserves polygon order."""

def to_geojson(shape: object) -> dict:
    """Convert a native polygon or multi-shape into a GeoJSON-like dictionary with closed rings in [lng, lat] order."""

def from_geojson(geojson: dict) -> object:
    """Convert a GeoJSON Polygon or MultiPolygon dictionary into a native shape exposing __geo_interface__; rejects unsupported types."""

Dependencies { .dependencies }

h3 { .dependency }

Provides geospatial containers and GeoJSON interoperability.

Version

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