1

I want to use the "fix geometries" tool in the Python console in QGIS. However, I can't find anywhere, how to function is called and how to use it as code. I tried

QgsProcessingOutputVectorLayer(input_path, output_path)

But I guess this is wrong, since it does not work. Any hints?

2

You can call fix geometries algorithm as follows in pyqgis:

import processing
layer = iface.activeLayer()
fix_layer = processing.run("native:fixgeometries", {'INPUT':layer,'OUTPUT':'memory:'})['OUTPUT']

I tried it in qgis 3.10

3
  • Can you recommend a website or anything alike where to look up all the commands? For me it seems like the information is kind of scattered across several websites. I always take ages to find information on how to call which tool. – Zoe Aug 24 '20 at 21:02
  • 1
    @blumige_statistik to know how to run a processing algorithm I do the following: I run the algorithm and then go to the menu Processing > History > and then select the last algorithm executed. When you select it you can see how to run it using pyqgis. – Leo Cardona Aug 24 '20 at 21:58
  • 1
    This answer can help you: gis.stackexchange.com/a/372681/120426 – Leo Cardona Aug 28 '20 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.