[Qgis-developer] Basic question: How to select a layer in the GUI and get the handle in the Python code?

Ole Nielsen ole.moller.nielsen at gmail.com
Wed Dec 7 08:28:28 EST 2011


Hi Alexander and mailing list

Thanks for the quick reply - it is great to have the support of this
community.

If I understand you correctly, you want to access current selected layer,
> right?
> Use self.iface.mapCanvas().currentLayer() for this
>

Sorry, I was perhaps not as clear as I could have been. I have already
written plugins using the currentLayer option. What I need now is to
combine two layers for a specific analysis. So I imagine being able to
select them through the plugin GUI selection combos and return the two
layer handles to the Python code in the same format as what is provided by
current layer. However, I have no idea how to start doing this.


> > Also, is there such a thing as a reference manual for the python plugin
> API?
> Python API mainly the same as C++ API, so you can use C++ API from [0]
>
OK


> Also there is PyQGIS Developer Cookbook [1] where you can find some code
> examples
>
Yes - I already read that and found it very helpful. However, nowhere to be
seen are explanations of the fundamentals of selecting layers through the
plugin and working with them.

Your help is much appreciated
Cheers
Ole
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20111207/2b2e4f96/attachment.html


More information about the Qgis-developer mailing list