Add merge_layers
This commit is contained in:
parent
d713c1b250
commit
7289f82d1a
26
services_scripts/merge_layers.py
Normal file
26
services_scripts/merge_layers.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user