or run

tessl search
Log in

Version

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

tessl/pypi-fiona

tessl install tessl/pypi-fiona@1.10.0

Fiona reads and writes spatial data files

Agent Success

Agent success rate when using this tile

88%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.1x

Baseline

Agent success rate without this tile

80%

task.mdevals/scenario-4/

Geometry Format Converter

Build a utility that converts between different geometry representation formats, with a focus on binary geometry handling.

Requirements

Create a Python module that provides functionality to:

  1. Read geometry from a Well-Known Binary (WKB) format and convert it to a human-readable dictionary representation
  2. Convert geometry dictionaries to WKB binary format for efficient storage and transmission
  3. Validate the round-trip conversion - ensure that converting a geometry to WKB and back produces an equivalent geometry

The module should handle common geometry types including:

  • Points (2D coordinates)
  • LineStrings (sequences of points)
  • Polygons (with exterior rings)

Test Cases

  • Reading a Point geometry from WKB bytes produces a dictionary with type 'Point' and correct coordinates @test
  • Converting a Point geometry dictionary to WKB bytes and back produces an equivalent geometry @test
  • Reading a LineString geometry from WKB bytes produces a dictionary with type 'LineString' and correct coordinate sequence @test
  • Converting a Polygon geometry dictionary to WKB format produces valid binary data @test

Implementation

@generates

API

def wkb_to_geometry(wkb_bytes):
    """
    Parse WKB binary data and return a geometry dictionary.

    Parameters:
    - wkb_bytes: bytes, Well-Known Binary geometry data

    Returns:
    dict: GeoJSON-like geometry with 'type' and 'coordinates' keys
    """

def geometry_to_wkb(geometry):
    """
    Convert a geometry dictionary to WKB binary format.

    Parameters:
    - geometry: dict, GeoJSON-like geometry with 'type' and 'coordinates'

    Returns:
    bytes: Well-Known Binary representation of the geometry
    """

def validate_roundtrip(geometry):
    """
    Validate that a geometry survives round-trip conversion to WKB and back.

    Parameters:
    - geometry: dict, GeoJSON-like geometry

    Returns:
    bool: True if the round-trip conversion produces an equivalent geometry
    """

Dependencies { .dependencies }

fiona { .dependency }

Provides geospatial data reading and writing capabilities, including WKB binary geometry handling.