Re: [QGIS-Developer] PyQGIS: Check if layer is already loaded?

2017-06-04 Thread Siki Zoltan
Dear Magnus. you can iterate through the layers: for lay in QgsMapLayerRegistry.instance().mapLayers().values(): if lay.name() == your_layer_name: your layer is loaded Regards, Zoltan On Sun, 4 Jun 2017, Magnus Homann wrote: I'm writing a plugin that adds feature to a SHP-layer,

[QGIS-Developer] PyQGIS: Check if layer is already loaded?

2017-06-04 Thread Magnus Homann
I'm writing a plugin that adds feature to a SHP-layer, specified as a filename. If the layer already is loaded in Qgis, I want to check for and use the loaded layer instead of creating a new from the same SHP-file. Is this even possible? ___