Fiona reads and writes spatial data files
88
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.
Install with Tessl CLI
npx tessl i tessl/pypi-fionadocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10