From 24887fd7498c644d93ecadb36d673ee8a1f79962 Mon Sep 17 00:00:00 2001 From: Ben van Basten Date: Fri, 22 Sep 2023 11:36:07 +0200 Subject: [PATCH] Removed unused code --- utils/geo_utils.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/utils/geo_utils.py b/utils/geo_utils.py index c019dfc8a..a8fd73231 100644 --- a/utils/geo_utils.py +++ b/utils/geo_utils.py @@ -3,9 +3,6 @@ from qgis.core import QgsCoordinateReferenceSystem from qgis.core import QgsCoordinateTransform from qgis.core import QgsProject -from qgis.core import QgsVectorLayer -from qgis.core import QgsField -from qgis.core import QgsWkbTypes def get_coord_transformation_instance(src_epsg, dest_epsg): @@ -16,29 +13,3 @@ def get_coord_transformation_instance(src_epsg, dest_epsg): src_crs = QgsCoordinateReferenceSystem(int(src_epsg)) dest_crs = QgsCoordinateReferenceSystem(int(dest_epsg)) return QgsCoordinateTransform(src_crs, dest_crs, QgsProject.instance()) - - -def copy_vectorlayer_attributes(source_layer: QgsVectorLayer, layer_name: str, additional_attributes) -> QgsVectorLayer: - """ - Create a new QgsVectorLayer containing the attributes of the base_layer plus the list - of additional attributes. - """ - source_provider = source_layer.dataProvider() - - uri = "{0}?crs=EPSG:{1}".format( - QgsWkbTypes.displayString(source_provider.wkbType()).lstrip("WKB"), - str(source_provider.crs().postgisSrid()), - ) - - dest_layer = QgsVectorLayer(uri, layer_name, "memory") - dest_provider = dest_layer.dataProvider() - dest_provider.addAttributes(source_provider.fields()) - - new_attributes = [] - for name, type in additional_attributes.items(): - new_attributes.append(QgsField(name, type)) - - dest_provider.addAttributes(new_attributes) - dest_layer.updateFields() - - return dest_layer