tessl install tessl/pypi-fiona@1.10.0Fiona 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%
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.
Create a Python program that:
The input will be a GeoJSON file containing features with:
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.
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
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
"""
passProvides reading and writing of GIS vector data in multiple formats.