[gdal-dev] Support for reading GDAL datasets in compressed archives(.gz and .zip)

Baumann, Konstantin Konstantin.Baumann at hpi.uni-potsdam.de
Wed Aug 27 03:00:50 EDT 2008


Hi Even!

That sounds cool. Is there also a function for retrieving all available
files inside of a ZIP archive?

Kind regards,
	Kosta 

> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at mines-paris.org] 
> Sent: Monday, August 25, 2008 11:41 PM
> To: gdal-dev at lists.osgeo.org
> Subject: [gdal-dev] Support for reading GDAL datasets in 
> compressed archives(.gz and .zip)
> 
> Folks,
> 
> I've just commited code in gdal 1.6.0dev SVN trunk that 
> enables GDAL to 
> decompress on-the-fly data from GZIP (.gz) and ZIP (.zip) archives.
> 
> This is implemented as 2 virtual file systems (like /vsimem for 
> example), /vsigzip and /vsizip. Only read-only access is supported.
> 
> Note that performance will not be very impressive, as random 
> access to ZIP 
> file is slow by nature, although some optimizations have been 
> made to make it 
> faster and generally usable.
> 
> ----------------------------------
> To read from a .gz file,
> ----------------------------------
> gdalinfo /vsigzip/path/to/the/file.gz were 
> path/to/the/file.gz is relative or 
> absolute.
> 
> The first time that a .gz file is read, a small 
> .gz.properties file will be 
> generated (if possible) to capture the uncompressed data 
> size. This will make 
> following opening of that dataset much faster.
> 
> --------------------------------------
> * To read from a .zip file,
> -------------------------------------
> gdalinfo /vsizip/path/to/the/file.zip/path/inside/the/zip/file were 
> path/to/the/file.zip is relative or absolute and 
> path/inside/the/zip/file is 
> the relative path to the file inside the archive.
> 
> For example gdalinfo /vsizip/myarchive.zip/subdir1/file1.tif
> 
> The ReadDir() method is implemented for the .zip archives, so 
> a driver will be 
> able to find files relative to the given file inside the archive. For 
> example, you can read a CADRG dataset from the zipped archive 
> of the a.toc 
> file and all its NITF tiles.
> 
> Small syntaxic sugar : if the .zip file contains only one 
> file located at its 
> root, just mentionning "/vsizip/path/to/the/file.zip" will work.
> 
> ------------------------------------------------
> 
> The fact that this new capability is implemented as virtual 
> file systems imply 
> that it will only work for GDAL drivers supporting the "large 
> file API". A 
> list of such drivers is : PNG, JPEG, ILWIS, GTiff, GIF, 
> JP2KAK, NITF, ADRG, 
> DTED, SRTMHGT, BMP, LCP, HFA (Erdas Imagine), AAIGRID. Other 
> drivers may work 
> too (I just looked for those advertizing the 
> GDAL_DCAP_VIRTUALIO capability)
> 
> (See http://trac.osgeo.org/gdal/ticket/1369 for the history 
> of that feature.)
> 
> Best regards
> 
> Even
> 
> 


More information about the gdal-dev mailing list