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?

1 Answer 1


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

  • 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, 2020 at 21:02
  • 2
    @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. Aug 24, 2020 at 21:58
  • 1
    This answer can help you: gis.stackexchange.com/a/372681/120426 Aug 28, 2020 at 16:39
  • The pyQGIS API documentation is also a good resource. qgis.org/pyqgis/3.16
    – nr_aus
    Dec 16, 2021 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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