Re: [gdal-dev] Zip files and VISFileFromMemBuffer()

2017-02-03 Thread Sean Gillies
Yes (as I said off-list), that works too. I've written a post about Rasterio's MemoryFile and ZipMemoryFile here: https://github.com/mapbox/rasterio/issues/977. I like GDAL's virtual files a lot and I think that these classes could make them very accessible to Python programmers. On Wed, Feb 1,

Re: [gdal-dev] Zip files and VISFileFromMemBuffer()

2017-01-31 Thread Kurt Schwehr
Sean, Very cool. One follow up question, do you really need the "with" for open? Does this not work (and MemoryFile can drop the file descriptor as soon as it wants to)? with MemoryFile(open(path_zip_file, 'rb')) as memfile: with memfile.open('white-gemini-iv.vrt') as dataset:

Re: [gdal-dev] Zip files and VISFileFromMemBuffer()

2017-01-31 Thread Sean Gillies
Thanks for confirming that I was on the right trail, Even! I got it figured out: I was naively trying to open the /vsizip/vsimem/ file in update mode. In case you're interested, my new Python usage is like this: with open(path_zip_file, 'rb') as f: with MemoryFile(f) as memfile: with

Re: [gdal-dev] Zip files and VISFileFromMemBuffer()

2017-01-31 Thread Even Rouault
On mardi 31 janvier 2017 17:33:23 CET Sean Gillies wrote: > Hey all, > > The tests in > https://svn.osgeo.org/gdal/branches/1.9/autotest/gcore/vsizip.py show how > to create a zip archive in memory and create directories and files within > it. I'm looking for a shortcut. > > Given a sequence of

[gdal-dev] Zip files and VISFileFromMemBuffer()

2017-01-31 Thread Sean Gillies
Hey all, The tests in https://svn.osgeo.org/gdal/branches/1.9/autotest/gcore/vsizip.py show how to create a zip archive in memory and create directories and files within it. I'm looking for a shortcut. Given a sequence of bytes representing an existing zip file that contains a TIFF and a VRT