Re: How to use fiona.open to overwrite existing GPKG file?


Sean Gillies
 

Because a geopackage file can contain multiple layers, opening a layer in "w" mode does not overwrite the entire .gpkg file. If you want to overwrite a layer, you need to pass "overwrite=True" to fiona.open(). For example:

>>> with fiona.open("/tmp/coutwildrnp.gpkg", "w", driver="GPKG", crs=crs, schema=schema, layer="coutwildrnp", overwrite=True) as col:
...     col.write(feat)
...
>>> with fiona.open("/tmp/coutwildrnp.gpkg", layer="coutwildrnp") as col:
...     len(col)
...
1



On Thu, Jun 6, 2019 at 7:05 AM <joe.huang@...> wrote:
I'm trying to overwrite a temporary file with fiona,open, but it throws an error. Is there a way to get around this?



--
Sean Gillies

Join main@fiona.groups.io to automatically receive all group messages.