diff --git a/services_scripts/merge_layers.py b/services_scripts/merge_layers.py new file mode 100644 index 0000000..cc33617 --- /dev/null +++ b/services_scripts/merge_layers.py @@ -0,0 +1,26 @@ +from qgis.core import QgsApplication, QgsVectorLayer, QgsProcessingFeedback +from qgis.analysis import QgsNativeAlgorithms +import processing +from services_scripts.basic_functions import find_shp_files + + +root_folder = 'C:/Users/a_adli/PycharmProjects/hydroquebec_archetype_gispy/data/aEndeavor/clip_all' +layers_path = find_shp_files(root_folder) + +# Set the path to QGIS installation +QgsApplication.setPrefixPath("C:/Program Files/QGIS 3.34.1/apps/qgis", True) + +# Initialize QGIS application +qgs = QgsApplication([], False) +qgs.initQgis() + +# Add native algorithms provider +QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms()) + +merged_layer = 'C:/Users/a_adli/PycharmProjects/hydroquebec_archetype_gispy/data/aEndeavor/merged_all/merge_divisions.shp' + +params = {'LAYERS': layers_path, + 'CRS': None, + 'OUTPUT': merged_layer} + +processing.run("native:mergevectorlayers", params)