diff --git a/luftbildfinder_nrw.py b/luftbildfinder_nrw.py index a88fe5c..0ae13fc 100644 --- a/luftbildfinder_nrw.py +++ b/luftbildfinder_nrw.py @@ -368,29 +368,33 @@ def selected_years(): new_group = root.insertGroup(0, group_name) metadata_layers = [] + added_layers = set() for year, date, service, infolayer, layer in selected_years: - if not any(item[1] == infolayer for item in metadata_layers): - metadata_layers.append((service, infolayer)) - BASE_URL = f"https://www.wms.nrw.de/geobasis/{service}" - urlWithParams = f"crs=EPSG:25832&format=image/png&layers={layer}&styles&url={BASE_URL}" - rlayer = QgsRasterLayer(urlWithParams, f"Luftbild {layer}", "wms") - if not rlayer.isValid(): - pass - else: - QgsProject.instance().addMapLayer(rlayer, False) - new_group.insertLayer(-1, rlayer) - rlayerNode = root.findLayer(rlayer.id()) - rlayerNode.setExpanded(False) - QgsProject.instance().addMapLayer(rlayer) - - self.canvas.flashGeometries( - [QgsGeometry.fromPointXY(original_pt)], - source_crs, - QColor(255, 0, 0, 255), - QColor(255, 0, 0, 255), - int(10), - int(500), - ) + if layer not in added_layers: + if not any(item[1] == infolayer for item in metadata_layers): + metadata_layers.append((service, infolayer)) + BASE_URL = f"https://www.wms.nrw.de/geobasis/{service}" + urlWithParams = f"crs=EPSG:25832&format=image/png&layers={layer}&styles&url={BASE_URL}" + rlayer = QgsRasterLayer(urlWithParams, f"Luftbild {layer}", "wms") + if not rlayer.isValid(): + pass + else: + QgsProject.instance().addMapLayer(rlayer, False) + new_group.insertLayer(-1, rlayer) + rlayerNode = root.findLayer(rlayer.id()) + rlayerNode.setExpanded(False) + QgsProject.instance().addMapLayer(rlayer) + + added_layers.add(layer) + + self.canvas.flashGeometries( + [QgsGeometry.fromPointXY(original_pt)], + source_crs, + QColor(255, 0, 0, 255), + QColor(255, 0, 0, 255), + int(10), + int(500), + ) if self.add_metadata_layer: for service, infolayer in metadata_layers: diff --git a/metadata.txt b/metadata.txt index f3aa0a1..fe9a2c5 100644 --- a/metadata.txt +++ b/metadata.txt @@ -10,7 +10,7 @@ about=Remark: - iDOP - vDOP tags=dop,idop,vdop,luftbild,luftbilder,nrw -version=0.4.0 +version=0.5.0 qgisMinimumVersion=3.16 author=Kreis Viersen email=open@kreis-viersen.de @@ -24,7 +24,9 @@ icon=luftbildfinder-nrw.png server=False deprecated=False -changelog=v0.4.0: +changelog=v0.5.0: + - füge Layer bei bestimmten Konstellationen nicht doppelt hinzu + v0.4.0: - behalte Auswahl wenn Sortierreihenfolge geändert wird v0.3.0 - behebe Fehler bei Option Metadatenlayer