CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-fiona

Fiona reads and writes spatial data files

88

1.10x
Overview
Eval results
Files

task.mdevals/scenario-1/

Bulk GIS Feature Loader

A utility for efficiently loading large collections of geographic features into GIS datasets with proper transaction handling and error recovery.

Capabilities

Load features with automatic batching

Write features to a GeoPackage dataset while leveraging automatic transaction batching for optimal performance.

  • Given a list of 5 point features, writing them to a new GeoPackage creates all features successfully @test
  • Given a list of 25,000 point features, writing them to a new GeoPackage completes efficiently using batched writes @test

Handle write errors gracefully

Ensure that when errors occur during bulk writes, the system behaves predictably.

  • When an invalid feature is encountered during a write operation, an appropriate error is raised @test
  • When writing features with an incorrect schema, an appropriate error is raised @test

Support different output formats

Write features to various GIS formats that support transaction operations.

  • Given a list of features, writing them to a GeoJSON file creates all features successfully @test
  • Given a list of features, writing them to a Shapefile creates all features successfully @test

Implementation

@generates

API

def load_features(features, output_path, driver='GPKG', crs='EPSG:4326'):
    """
    Load a list of geographic features into a GIS dataset.

    Args:
        features: List of feature dictionaries with 'geometry' and 'properties' keys.
                 Each geometry should have 'type' and 'coordinates'.
                 Example: {'geometry': {'type': 'Point', 'coordinates': [0, 0]},
                          'properties': {'name': 'Location 1'}}
        output_path: Path to the output file
        driver: Output format driver (default: 'GPKG' for GeoPackage)
        crs: Coordinate reference system (default: 'EPSG:4326')

    Returns:
        Number of features successfully written

    Raises:
        ValueError: If features list is empty or contains invalid data
        IOError: If output file cannot be created or written
    """
    pass

Dependencies { .dependencies }

fiona { .dependency }

Provides GIS data I/O capabilities with transaction support for efficient bulk writes.

Install with Tessl CLI

npx tessl i tessl/pypi-fiona

tile.json