Thank you for the reply - it is useful and I am getting closer. However, it is not that I want to specify the name, rather I&#39;d like to be able to browser the active layers (or maybe even layer files) and select two layers for analysis. So I am maybe looking for a file or layer selection combo and a hint on how to make it work.<div>
<br></div><div>I just need to pick two existing layers from the UI and get handles to them. After the processing, I need to specify a filename to store the result to and will also need help with  that.</div><div><div>I have very limited experience with UIs so please forgive me my basic questions.</div>
<div><br></div><div>Cheers and thanks</div><div>Ole</div><div><br><div class="gmail_quote">On Wed, Dec 7, 2011 at 8:57 PM, Alexander Bruy <span dir="ltr">&lt;<a href="mailto:alexander.bruy@gmail.com">alexander.bruy@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">Hi Ole,<br>
<br>
2011/12/7 Ole Nielsen &lt;<a href="mailto:ole.moller.nielsen@gmail.com">ole.moller.nielsen@gmail.com</a>&gt;:<br>
</div><div class="im">&gt; Sorry, I was perhaps not as clear as I could have been. I have already<br>
&gt; written plugins using the currentLayer option. What I need now is to combine<br>
&gt; two layers for a specific analysis. So I imagine being able to select them<br>
&gt; through the plugin GUI selection combos and return the two layer handles to<br>
&gt; the Python code in the same format as what is provided by current layer.<br>
&gt; However, I have no idea how to start doing this.<br>
<br>
</div>Ah, understand. That&#39;s not so difficult. You need to get layer name<br>
from combobox,<br>
then find layer by name. Here is small function that did this work for you<br>
<br>
def getVectorLayerByName( layerName ):<br>
  layerMap = QgsMapLayerRegistry.instance().mapLayers()<br>
  for name, layer in layerMap.iteritems():<br>
    if layer.type() == QgsMapLayer.VectorLayer and <a href="http://layer.name" target="_blank">layer.name</a>() == layerName:<br>
      if layer.isValid():<br>
        return layer<br>
      else:<br>
        return None<br>
<br>
So in your code you can simply do something like this<br>
<br>
layerA = getVectorLayerByName( self.cmbLayerA.currentText() )<br>
layerB = getVectorLayerByName( self.cmbLayerB.currentText() )<br>
<br>
Hope this helps<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Alexander Bruy<br>
NextGIS<br>
</font></span></blockquote></div><br></div></div>