Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I thought I would try to write a plugin for QGIS (some Python code that I hoped I could easily port) I started following http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html but that turned out to be hopelessly out of date. I turned to http://www.qgis.org/en/docs/pyqgis_developer_cookbook/intro.html instead and started going through the intro for the Python console and stumbled at the second query.

layer = qgis.utils.iface.activeLayer()

worked fine but then

layer.getLayerID()

threw up

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

and sure enough code completion in the console would seem to suggest that this doesn't exist. So my question is "where do I find up to date, usable instructions for developing plugins for QGIS 2.2?" It would seem that unless you are already "in the know" there is no way in. Or am I just being paranoid?

share|improve this question

1 Answer 1

The most complete API docs are located at http://qgis.org/api/2.2/classQgsMapLayer.html

A good Python-specific resource is The PyQGIS Programmer's Guide. It's new and written for the 2.x API.

Concerning the pyQGIS Cookbook: I assume you are referring to the screenshot on http://www.qgis.org/en/docs/pyqgis_developer_cookbook/intro.html? This seems to have slipped through when the documentation was updated. That can happen. If you find documentation issues, it would be extremely helpful if you report them on the QGIS Documentation Github page.

share|improve this answer
    
Any idea when the newbie intro will be updated? Ploughing through the API each time the old intro bowls a googly doesn't appeal at the moment (in the middle of writing PhD thesis and need less, not more stress). –  mercergeoinfo Mar 9 at 1:57
1  
Try locatepress.com/ppg –  gsherman Mar 9 at 4:36
    
All documentation resources are continually updated - mostly by volunteers. You can support their efforts by letting them know if you spot certain issues. –  underdark Mar 9 at 10:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.