Changes between Version 15 and Version 16 of UserDocs/ReadInZip
- Timestamp:
- Oct 2, 2017, 5:21:14 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UserDocs/ReadInZip
v15 v16 1 = Reading a GDAL dataset in a .gz file or a .zip archive=1 = Reading a GDAL or OGR datasets in archive files = 2 2 3 3 == Summary == … … 6 6 The archive formats that are handled are single gzip'ed file (ending with .gz) and ZIP archives (ending with .zip). 7 7 8 This is implemented as 2 virtual file systems (like /vsimemfor9 example), /vsigzip and /vsizip. From .zip files only read-only access is supported, while the /vsigzipdriver supports read and sequential write.8 This is implemented as 2 virtual file systems (like `/vsimem` for 9 example), `/vsigzip` and `/vsizip`. From .zip files only read-only access is supported, while the `/vsigzip` driver supports read and sequential write. 10 10 Note that performance will not be very impressive, as random access inside gzip data is slow by nature, although some optimizations have been made to make it faster and generally usable ("snapshots" of the gzip state are taken from time to time, so that further access to a given offset inside the file just needs to restart decompression from the nearest snapshot) 11 11 … … 21 21 were path/to/the/file.gz is relative or absolute. 22 22 23 If the path is absolute, it should begin with a / on a Unix-like OS (or C:\ on Windows), so the line looks like /vsigzip//home/gdal/...23 If the path is absolute, it should begin with a `/` on a Unix-like OS (or `C:\` on Windows), so the line looks like `/vsigzip//home/gdal/...` 24 24 25 25 The first time that a .gz file is read, a small .gz.properties file will be … … 27 27 following opening of that dataset much faster. 28 28 29 A VSIStatL("/vsigzip/...")call will return the uncompressed size of the file.29 A `VSIStatL("/vsigzip/...")` call will return the uncompressed size of the file. 30 30 31 31 The special file handler is [http://gdal.org/cpl__vsi_8h.html#3cde09f204df6f417653b7af4761178e VSIInstallGZipFileHandler ()] … … 40 40 the relative path to the file inside the archive. 41 41 42 If the path is absolute, it should begin with a / on a Unix-like OS (or C:\ on Windows), so the line looks like /vsizip//home/gdal/...42 If the path is absolute, it should begin with a `/` on a Unix-like OS (or `C:\` on Windows), so the line looks like `/vsizip//home/gdal/...` 43 43 44 For example gdalinfo /vsizip/myarchive.zip/subdir1/file1.tif44 For example `gdalinfo /vsizip/myarchive.zip/subdir1/file1.tif` 45 45 46 46 The ReadDir() method is implemented for the .zip archives, so a driver will be … … 49 49 file and all its NITF tiles. 50 50 51 A VSIStatL("/vsizip/...")call will return the uncompressed size of the file.51 A `VSIStatL("/vsizip/...")` call will return the uncompressed size of the file. 52 52 Directories inside the ZIP file can be distinguished from regular files with 53 53 the VSI_ISDIR(stat.st_mode) macro as for regular file systems. 54 54 55 55 Small syntaxic sugar : if the .zip file contains only one file located at its 56 root, just mentionning "/vsizip/path/to/the/file.zip"will work.56 root, just mentionning `/vsizip/path/to/the/file.zip` will work. 57 57 58 58 The special file handler is [http://gdal.org/cpl__vsi_8h.html#884fac3cd6be2c09deb807e959d78b3a VSIInstallZipFileHandler ()] … … 61 61 62 62 Since GDAL 1.8.0, it is possible to access a file inside a .tar (uncompressed) or 63 a .tar.gz/.tgz (compressed) archive. The syntax is very similar to the /vsizipcase :63 a .tar.gz/.tgz (compressed) archive. The syntax is very similar to the `/vsizip` case : 64 64 65 65 {{{ … … 112 112 * EHdr 113 113 114 The full list can be obtained by looking at the driver marked with 'v' when running 'gdalinfo --formats'114 The full list can be obtained by looking at the driver marked with 'v' when running `gdalinfo --formats` 115 115 116 116 = vsicurl - to read from HTTP or FTP files (partial downloading) =