Add multipart to singleparts to the services
This commit is contained in:
parent
581e64d40c
commit
117a474a16
0
services_scripts/adding_area_field.py
Normal file
0
services_scripts/adding_area_field.py
Normal file
23
services_scripts/multipart_to_singleparts.py
Normal file
23
services_scripts/multipart_to_singleparts.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user