[Qgis-developer] This had escaped me!

Etienne Tourigny etourigny.dev at gmail.com
Wed May 9 07:30:26 PDT 2012


For now file open and commandline open only work in "Passthru" mode -
which works if there is only one "dataset" inside the file.

it passes the base file e.g. /vsizip/file.zip to gdal/ogr

whereas scan mode actually opens the zip and if there are many files
inside will pass the complete path to gdal/ogr

For zipped shapes it depends on gdal version I guess.  Should work
with gdal>=1.8 though.

For example, with gdal-1.9 I can do

$ ogrinfo -ro /vsizip//home/src/qgis/qgis-etiennesky/tests/testdata/points2.zip
INFO: Open of `/vsizip//home/src/qgis/qgis-etiennesky/tests/testdata/points2.zip'
      using driver `ESRI Shapefile' successful.
1: points (Point)

and when I run qgis /home/src/qgis/qgis-etiennesky/tests/testdata/points2.zip
it works.

Perhaps your zip files contain more than 1 dataset?

Try this to see if you gdal/ogr version supports it:
ogrinfo -ro /vsizip/path_to_shape_zip.zip

and if not try with the qgis source test file
/tests/testdata/points2.zip and send me your file (or its listing).

Now on to multi-dataset zipfiles:

I fixed that last night, by presenting a dialog similar to the
sublayers dialog.

Check out my repos at

Also in there is support for .tar and .tar.gz, although .tar.gz are
not scanned immediately when the folder is opened in the browser, you
have to open the file to scan the contents (because of performance
issues with .tar.gz)
.tar and .zip files are scanned when the folder is opened, because the
time to consult file contents is minimal.

I don't think these features will be in 1.8, but I'll submit them
after 1.8 is out.


On Wed, May 9, 2012 at 10:41 AM, Giovanni Manghi
<giovanni.manghi at faunalia.pt> wrote:
> Hi Etienne,
>> > just noticed one thing, if the zip file contains >1 raster then is not
>> > shown in the browser, while if it contains just one it works ok (also
>> > from the add raster dialog).
>> You have to change the "Scan zip" settings (in the general options),
>> the possible values are
>> - No
>> - Passthru - this just sets the uri to /vsizip/file.zip (which is the
>> way gdal/ogr supports zip files) and does not support multiple files
>> - Basic Scan - this opens the zip file and presents the files which
>> extension is supported  (.tif, .shp, etc)
>> - Full Scan - this presents the files inside the zip which are valid
>> (takes longer)
>> Default value is Passthru, but perhaps "Basic Scan" would be a better default?
>> I had chosen Passthru as a default before using QuaZip, but it is
>> probably not the best default now.
> Thanks, it works.
> I just noticed that today the only way to add a zipped shape is through
> the browser and the add vector layer dialog, drag and drop and CLI all
> return "is not a valid or recognized data source". If is a zipped raster
> all methods work fine.
> Can you confirm?
> cheers
> -- Giovanni --

More information about the Qgis-developer mailing list