{"id":1480,"library":"fiona","title":"Fiona (Spatial Data I/O)","description":"Fiona is a Python library for reading and writing spatial data files, providing a high-level API built on GDAL/OGR. It enables seamless interaction with various vector data formats like Shapefile, GeoJSON, and KML. The current version is 1.10.1, with an active development cycle that includes regular bug fixes, feature additions, and pre-releases leading up to major versions.","status":"active","version":"1.10.1","language":"en","source_language":"en","source_url":"https://github.com/Toblerity/Fiona","tags":["geospatial","gis","ogr","gdal","vector","shapefile","geojson","mapping"],"install":[{"cmd":"pip install fiona","lang":"bash","label":"Install Fiona"}],"dependencies":[{"reason":"Requires Python 3.8 or higher.","package":"python","optional":false}],"imports":[{"symbol":"fiona","correct":"import fiona"},{"symbol":"open","correct":"import fiona\n# ...\nfiona.open(...)"},{"symbol":"CRS","correct":"from fiona.crs import CRS"},{"note":"The `fiona.path` module and its members were deprecated and removed in 1.10.0; use standard `os.path` instead.","wrong":"import fiona.path","symbol":"path","correct":"import os.path"}],"quickstart":{"code":"import fiona\nimport os\n\n# Create a dummy GeoJSON file for demonstration\ngeoj_feature = {\n    'type': 'Feature',\n    'geometry': {'type': 'Point', 'coordinates': (10, 20)},\n    'properties': {'name': 'test_point'}\n}\n\n# Define the schema for the output file\nschema = {\n    'geometry': 'Point',\n    'properties': {'name': 'str'},\n}\n\n# Define the Coordinate Reference System (CRS)\ncrs = 'EPSG:4326'\n\n# Define the driver (file format)\ndriver = 'GeoJSON'\n\noutput_file = 'temp_fiona_test.geojson'\n\n# Write data to a new GeoJSON file\nwith fiona.open(\n    output_file,\n    'w',\n    driver=driver,\n    crs=crs,\n    schema=schema\n) as collection:\n    collection.write(geoj_feature)\n\nprint(f\"Successfully wrote data to {output_file}\")\n\n# Read data from the created file\nwith fiona.open(output_file, 'r') as collection:\n    print(f\"\\nDriver: {collection.driver}\")\n    print(f\"CRS: {collection.crs}\")\n    print(f\"Schema: {collection.schema}\")\n    for feature in collection:\n        print(f\"Read Feature: {feature}\")\n\n# Clean up the dummy file\nos.remove(output_file)\nprint(f\"Cleaned up {output_file}\")","lang":"python","description":"This quickstart demonstrates how to create a simple GeoJSON file using Fiona, write a feature to it, and then read the data back. It covers defining schema, CRS, and using the `fiona.open` context manager for file operations."},"warnings":[{"fix":"Replace usages of `fiona.path` functions with standard Python equivalents, such as `os.path` for path manipulation or the `io` module for in-memory resources.","message":"The `fiona.path` module and its members (e.g., `fiona.fspath`, `fiona.BytesIOResource`) were removed in Fiona 1.10.0. Code relying on these for path manipulation or in-memory resources will break.","severity":"breaking","affected_versions":">=1.10.0"},{"fix":"Avoid direct mutation of these objects. For modifications, create new instances with updated values, or use methods provided by Fiona for safer data manipulation if available.","message":"Mutable item access to `Feature`, `Geometry`, and `Properties` instances is deprecated. Instances of these classes will become immutable in a future major version (2.0), leading to `TypeError` if modification is attempted.","severity":"deprecated","affected_versions":">=1.10.0"},{"fix":"Ensure a compatible GDAL/PROJ/GEOS installation. Consider using Conda (e.g., `conda install -c conda-forge fiona`) for robust dependency management on non-standard setups, or building from source with specific GDAL versions if necessary.","message":"Fiona relies on underlying C libraries (GDAL, PROJ, GEOS). While `pip install fiona` typically provides wheels bundling these for common platforms, issues can arise on specific systems, custom environments, or when mixing with system-installed GDAL versions, leading to import errors or runtime crashes.","severity":"gotcha","affected_versions":"<all>"},{"fix":"Refactor code to avoid direct reliance on these internal schema attributes. Refer to the official documentation for recommended ways to inspect or manage field types.","message":"Attributes like `fiona.schema.FIELD_TYPES`, `FIELD_TYPES_MAP`, and `FIELD_TYPES_MAP_REV` are deprecated and will be removed in Fiona 2.0.","severity":"deprecated","affected_versions":">=1.10.0"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}