I am Esri-trained, trying to move into QGIS using Python. Simply trying to add a vector layer in Qgis returns the below error:
TypeError: QgisInterface.addVectorLayer(QString, QString, QString): first argument of unbound method must have type 'QgisInterface'
Here's my code:
layer = qgis.core.QgsVectorLayer("C:\mypath\mypath\GTM_adm1.shp", "GTM_adm1", "ogr")qgis.gui.QgisInterface.addVectorLayer(layer, "GTM_adm1", "ogr")Not sure what I'm missing here but the Vector layer object is in the registry.
أكثر...
TypeError: QgisInterface.addVectorLayer(QString, QString, QString): first argument of unbound method must have type 'QgisInterface'
Here's my code:
layer = qgis.core.QgsVectorLayer("C:\mypath\mypath\GTM_adm1.shp", "GTM_adm1", "ogr")qgis.gui.QgisInterface.addVectorLayer(layer, "GTM_adm1", "ogr")Not sure what I'm missing here but the Vector layer object is in the registry.
أكثر...