Hi,
I would like to write a small python plugin to analyse some raster data,
but I haven't managed to select a loaded layer yet. I searched the howtos and
found several simple examples about:
# get the currently active layer
layer = self.iface.mapCanvas().currentLayer()
but as I said I would l
Hi Otto,
here a small extract from a plugin I wrote:
Just check for the layer type to only list raster layers
def initLayerCombobox(self,combobox, default):
reg = QgsMapLayerRegistry.instance()
for ( key, layer ) in reg.mapLayers().iteritems():
combobox.addItem( l
Hi Matthias,
thanks for your help. I guess it is similar to what I found?
def getRasterLayersNames():
layerList = []
layerMap = QgsMapLayerRegistry.instance().mapLayers()
for name, layer in layerMap.iteritems():
if layer.type() == QgsMapLayer.RasterLayer an
Hi Otto,
Try this
class MyPluginDialog (QDialog,Ui_MyPluginDialog)::
def __init__(self):
self.setupUi(self)
self.initLayerCombobox( self.ui.InRastA, 'key_of_default_layer' )
def initLayerCombobox(self,combobox, default):
combobox.clear()
reg = QgsMapLayer
Hi Matthias,
that works. Thanks a lot!
Regards
Otto
Am Thu, 17 Jan 2013 17:24:43 +0100
schrieb Matthias Kuhn :
> Hi Otto,
>
> Try this
>
> class MyPluginDialog (QDialog,Ui_MyPluginDialog)::
> def __init__(self):
> self.setupUi(self)
> self.initLayerCombobox( self.ui.InR