[Qgis-developer] Can not load shape files with QgsVectorLAyer
function
Volkan Kepoglu
vkepoglu at gmail.com
Wed Oct 21 04:28:59 EDT 2009
Hi Lutfi,
you can try this punch of code for starting:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
vlayer = QgsVectorLayer("c/temp/abc.shp", "hebe", "ogr")
print vlayer.source()
QgsMapLayerRegistry.instance().addMapLayer(vlayer)
QMessageBox.information(iface.mainWindow(), "info", "file:
"+str(vlayer.source())+" is added.")
regards,
volkan
On Wed, Oct 21, 2009 at 11:18 AM, <luca_manganelli at comune.trento.it> wrote:
>
>
> qgis-developer-bounces at lists.osgeo.org scritti il 21/10/2009 10.13.51
>
> > Hello,
> >
> > vlayer = QgsVectorLayer("C:
> >
>
> \Users\lutfi\Documents\tezzzz\shapefiles\data\SGID93_BOUNDARIES_Municipalities.
>
> > shp", "hebe", "ogr")
> >
> > I am trying to run the code above and no matter what is the file,
> > featurecount always return zero in python console so that ny plugin
> > does not work. What may be the problem?
>
> see the slash "\", it does an escape.
>
> Try it with double shlashes ("\\") or inverted slash ("/").
>
> It's a common error (I've made many mistakes with it :-) )
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
--
Regards,
Volkan Osman Kepoglu
PhD Candidate
GGIT Department in METU,
http:/ggit.metu.edu.tr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20091021/abb43ab9/attachment.html
More information about the Qgis-developer
mailing list