TransWikia.com

QGIS3.x using processing algorithms outside of python console (when writing a plugin)

Geographic Information Systems Asked by Entropy125 on December 7, 2020

For a school assignment I need to write a QGIS plugin.
Part of the plugin that i’m writing needs to use the ‘select by location’ processing tool on a previously created buffer.

The codelines that I want to use is:

import processing

def selectBagFromOverlapBuffer(self):
        self.layer1 = QgsProject.instance().mapLayersByName('bag:verblijfsobject')
        self.layer2 = QgsProject.instance().mapLayersByName('buffer')
        processing.runalg('qgis:selectbylocation',self.layer1, self.layer2,u'within',0)

The error message I get is "module ‘processing’ has no attribute ‘runalg’
Is there a step I’m missing with accesing processing tools from a plugin .py script?

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