How do I write many vector datasets (layers or GeoDataFrames) to a GeoPackage?
I have 12 GeoDataFrames that I want to store in one GeoPackage as separate layers. I'm writing these layers to the same file from multiple processes at the same time.
Below is the code I use, and it produces an error:
pyogrio.errors.DataSourceError: A file system object called '... lines_1900.gpkg' already exists.
# write to GeoPackage
gpkg_name = 'lines_' + year + '.gpkg'
gpkg_file = os.path.join(out_folder, gpkg_name)
trip_lines.to_file(gpkg_file, layer=month, driver="GPKG")
Or is this a completely wrong approach?
month
?to_file
call. Alternatively you could comment out the to_file calls and replace them withprint("%s %d" % (gpkg_file, month))
so you can see the parameters printed to the console without stepping your code. But this now transforms to general coding and debugging, nothing specific to geopandas.