geopandas / pyogrio

Vectorized vector I/O using OGR
https://pyogrio.readthedocs.io
MIT License
257 stars 21 forks source link

Allow zip output from writing in-memory dataset #402

Open brendan-ward opened 2 months ago

brendan-ward commented 2 months ago

Follow-on to #397

Some drivers create multiple files and we cannot write them to an io.BytesIO object and have them correctly handled later, but GDAL creates these successfully within the in-memory directory that we use.

It would be possible to write these to the io.BytesIO object if we zipped the in-memory directory, and then write that zipfile to the io.BytesIO object.

We could handle this by adding a zipped=True (or similar) parameter to write() / write_arrow() / write_dataframe() functions.

Alternatively, it might be possible to pass in an open zipfile.ZipFile instance and write files / directories from the in-memory directory to it. Unclear if this would be simpler.