Thanks Richard. It was the missing second slash.

If you drag n drop a zipped shapefile into the map canvas a selection dialog 
appears with all the layers inside the zip file. Is this behaviour also 
possible out-of-the-box with python?

Regards
Stefan 

> -----Ursprüngliche Nachricht-----
> Von: Richard Duivenvoorde [mailto:rdmaili...@duif.net]
> Gesendet: Freitag, 28. November 2014 09:57
> An: Ziegler Stefan; 'qgis-developer@lists.osgeo.org'
> Betreff: Re: [Qgis-developer] Load zipped shapefiles with python
> 
> On 27-11-14 13:08, Ziegler Stefan wrote:
> > Hi
> >
> > Is it possible to load zipped shapefiles with python? I have some zip files 
> > with several
> shapefiles in it. I tried something like this:
> >
> > vlayer = QgsVectorLayer("/vsizip/home/stefan/Downloads/2546.zip/lfp3.shp", 
> > LFP3,
> "ogr")
> >
> > But the layer is not valid.
> 
> Hi Stefan,
> 
> maybe you already figured out?
> 
> qgis.utils.iface.addVectorLayer("/vsizip//data/disk/home/richard/geodata/nl/autowegen.
> zip",
> "wegen", "ogr")
> 
> loads a layer to me. Note though that you get the 'crs' popup in between.
> 
> vlayer =
> QgsVectorLayer("/vsizip//data/disk/home/richard/geodata/nl/autowegen.zip",
> "wegen", "ogr")
> 
> also works.
> 
> Note:
> - /vsizip//   <= double /
> - "ogr"  <= no capitals
> (second argument is a string)
> 
> Regards,
> 
> Richard Duivenvoorde
> 
> 

_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to