Add multipart to singleparts to the services

This commit is contained in:
Alireza Adli 2024-02-28 13:40:18 -05:00
parent 581e64d40c
commit 117a474a16
2 changed files with 23 additions and 0 deletions

View File

View File

@ -0,0 +1,23 @@
from qgis.core import QgsApplication, QgsVectorLayer, QgsProcessingFeedback
from qgis.analysis import QgsNativeAlgorithms
import processing
# 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())
input_layer = 'C:/Users/a_adli/PycharmProjects/hydroquebec_archetype_gispy/data/output_data/delete_dups_4_partitioned|layername=delete_dups__partitioned'
singled_parts_layer = 'C:/Users/a_adli/PycharmProjects/hydroquebec_archetype_gispy/data/output_data/multi_to_single/multi_to_single2.shp'
params = {'INPUT': input_layer,
'OUTPUT': singled_parts_layer}
processing.run("native:multiparttosingleparts", params)
qgs.exitQgis()