[Qgis-user] How get the ID of active layer in python

Andrea Peri aperi2007 at gmail.com
Tue Dec 31 13:43:40 PST 2013


Hi,

This code from the PyQGIS Developer CookBook seem to be deprecated.

layer = qgis.utils.iface.activeLayer()
layer.getLayerID()

The qgis-console return this error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'QgsVectorLayer' object has no attribute 'getLayerID'

I'm start to learn the python in qgis.
Is there another choice for get the ID of active layer ?

Thx,

-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20131231/1b455106/attachment.html>


More information about the Qgis-user mailing list