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

Feature Lookup Module

Build a Python module that retrieves specific geographic features from a spatial data file by their unique identifiers.

Requirements

The module should provide a function that:

  • Accepts a path to a spatial data file (supporting common GIS formats like Shapefile, GeoPackage, GeoJSON)
  • Accepts a list of feature IDs to retrieve
  • Opens the spatial data file in read mode
  • Retrieves each requested feature by its ID
  • Returns a list of retrieved features as dictionaries
  • For feature IDs that do not exist, skips them without raising an error

Test Cases

  • Given a shapefile with 5 features (IDs 0-4), retrieving ID 2 returns that specific feature. @test
  • Given a GeoPackage with 10 features, retrieving IDs 3, 7, and 9 returns exactly those three features. @test
  • Given a spatial file with features having IDs 0-9, attempting to retrieve ID 15 prints a warning and returns an empty result. @test
  • Given a spatial file with 100 features, retrieving ID 0 and ID 99 returns both the first and last features. @test

Implementation

@generates

API

def retrieve_features_by_id(filepath: str, feature_ids: list[int]) -> list[dict]:
    """
    Retrieve geographic features from a spatial data file by their IDs.

    Args:
        filepath: Path to the spatial data file
        feature_ids: List of feature IDs to retrieve

    Returns:
        List of feature dictionaries (GeoJSON-like structure)
    """
    pass

Dependencies { .dependencies }

fiona { .dependency }

Provides GIS data reading capabilities and random access to features by ID.