2

I have the following catalog item in my kedro project

suggested_routes_table@geopandas: type: geopandas.GeoJSONDataSet filepath: data/04_feature/routes_suggestions_table.geojson load_args: driver: "GeoJSON" mode: "a"

The keyword argument mode: "a" stands for append, meaning that every time the node is run, it should append new rows to the geojson instead of overwriting the file in the path.

As stated in Kedro GeoJson documentation and innGeoPandas to_file() documentation, the appending mode can be used with selected drivers.

When checking the selected fiona drivers in my environment I got the following output

import fiona fiona.supported_drivers { 'ARCGEN': 'r', 'DXF': 'rw', 'CSV': 'raw', 'OpenFileGDB': 'r', 'ESRIJSON': 'r', 'ESRI Shapefile': 'raw', 'FlatGeobuf': 'rw', 'GeoJSON': 'raw', 'GeoJSONSeq': 'rw', 'GPKG': 'raw', 'GML': 'rw', 'OGR_GMT': 'rw', 'GPX': 'rw', 'GPSTrackMaker': 'rw', 'Idrisi': 'r', 'MapInfo File': 'raw', 'DGN': 'raw', 'PCIDSK': 'rw', 'OGR_PDS': 'r', 'S57': 'r', 'SQLite': 'raw', 'TopoJSON': 'r' }

Meaning that GeoJson, the driver that I'm specifying in Kedro, support appending mode.

I have tried different drivers always ending up with the following DataSetError when calling catalog.load("suggested_routes_table@geopandas")

DataSetError: Failed while loading data from data set GeoJSONDataSet(filepath=/Users/nicolasbetancourt/Documents/GitHub/jama-coaque-routes/jama-coaque-routes/data/04_fea ture/routes_suggestions_table.geojson, load_args={'driver': GeoJSON, 'mode': a}, protocol=file, save_args={'driver': GeoJSON}). No such file or directory /vsimem/ec1c814e95f9446290be2efde0c02145.json

As soon as I delete the line mode: "a" from the data catalog, the GeoJSON dataset is loaded perfectly. That's why I assume that the error is due to this keyword argument but I don't understand why because I'm using it with a supported driver.

Also, when I try to save a GeoPandasDataFrame in the same path using the keyword mode="a" it works perfectly. That's why I assume that the error comes from the interaction between kedro and fiona

Natalio
  • 31
  • 4

0 Answers0