TransWikia.com

Calling "fix geometries" in the QGIS python console?

Geographic Information Systems Asked by Zoe on October 11, 2020

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?

One Answer

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

Correct answer by Leo Cardona on October 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP