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 bytes representing an existing zip file that contains a > TIFF and a VRT (referencing the TIFF), is it possible to make a VSI file > from this buffer (using VISFileFromMemBuffer()) and then access the VRT > using a path like /vsizip/vsimem/archive.zip/example.vrt protocol?
Hi Sean, That sounds like you tested it and something went wrong ? Perhaps check the path to the source in the VRT and the value of the relativeToVRT attribute. Your above strategy does work for me: $ gdal_translate byte.tif byte.vrt -of VRT Input file size is 20, 20 $ zip byte.tif.zip byte.tif byte.vrt adding: byte.tif (deflated 96%) adding: byte.vrt (deflated 53%) $ python >>> from osgeo import gdal >>> data = open('byte.tif.zip', 'rb').read() >>> gdal.FileFromMemBuffer('/vsimem/archive.zip', data) >>> ds = gdal.Open('/vsizip/vsimem/archive.zip/byte.vrt') >>> ds.GetRasterBand(1).Checksum() 4672 Even -- Spatialys - Geospatial professional services http://www.spatialys.com
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev