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

GIS Data Format Converter

Build a tool that converts GIS vector data between different file formats. The tool should read spatial data from one format and write it to one or more output formats while preserving geometry and attribute information.

Requirements

Create a Python program that:

  1. Reads vector data from an input file (GeoJSON format)
  2. Converts and writes the data to multiple output formats:
    • Shapefile format
    • GeoPackage format
    • GeoJSONSeq (newline-delimited GeoJSON) format
  3. Preserves all geometry data, properties (attributes), and coordinate reference system information during conversion
  4. Handles datasets with different geometry types (Point, LineString, Polygon)
  5. Provides a function interface that accepts an input file path and output directory, then creates all three output formats

Input Data Format

The input will be a GeoJSON file containing features with:

  • Geometry (Point, LineString, or Polygon)
  • Properties as key-value pairs
  • An optional coordinate reference system

Output Requirements

For each output format, create files in the specified output directory:

  • output.shp (and associated .shx, .dbf files for Shapefile)
  • output.gpkg (GeoPackage)
  • output.geojsonseq (GeoJSONSeq)

All outputs must contain the same features, geometries, properties, and CRS as the input.

Test Cases

  • Given an input GeoJSON file with 3 point features (coordinates [-122.4, 37.8], [-122.5, 37.9], [-122.6, 38.0] with properties name="A"/"B"/"C" and value=1/2/3), when converted to Shapefile format, the output must contain exactly 3 features with matching geometries and properties. @test

  • Given an input GeoJSON file with 2 polygon features, when converted to GeoPackage format, the output must contain exactly 2 polygon features with correct geometry coordinates and property values. @test

  • Given an input GeoJSON file with point features in EPSG:4326 coordinate reference system, when converted to GeoJSONSeq format, the output must be a valid newline-delimited GeoJSON file with one feature per line. @test

API

def convert_to_multiple_formats(input_geojson_path: str, output_dir: str) -> None:
    """
    Convert GeoJSON input to Shapefile, GeoPackage, and GeoJSONSeq formats.

    Args:
        input_geojson_path: Path to input GeoJSON file
        output_dir: Directory where output files will be created
    """
    pass

Dependencies { .dependencies }

fiona { .dependency }

Provides reading and writing of GIS vector data in multiple formats.