Geographic Information Systems Asked by Toke on February 23, 2021
Is it possible to run the multiparts to singleparts function from the console with the processing_runalg
function?
Or is there another way?
Yes:
1) The proposed solution (Using processing algorithms from the console)
import processing
# find the algorithm
processing.alglist("Multipart to singleparts")
Multipart to singleparts----------------------------->qgis:multiparttosingleparts
# help
processing.alghelp("qgis:multiparttosingleparts")
ALGORITHM: Multipart to singleparts
INPUT <ParameterVector>
OUTPUT <OutputVector>
So the command is
processing.runalg("qgis:multiparttosingleparts","shape1.shp","shape2.shp")
2) an easiest solution
Each time you execute a Processing algorithm,the complete runalg command with values are saved in the .../.qgis2/processing/processing.log file
Execute the algorithm with a test layer and look at the last line of this file:
ALGORITHM|Mon Apr 14 2014
17:13:45|processing.runalg("qgis:multiparttosingleparts","/Users/shape1.shp","/Users/shape2.shp")
and you have the syntax of the command.
Correct answer by gene on February 23, 2021
QGIS3:
algSingle = processing.runAndLoadResults("qgis:multiparttosingleparts",{'INPUT': prelayer, 'OUTPUT': 'TEMPORARY_OUTPUT'})
layer = QgsProject.instance().mapLayer(algSingle['OUTPUT'])
Answered by aurel_nc on February 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP