0

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?

  • 1
    Use "run" instead of "runalg". – Kadir Şahbaz Nov 15 '20 at 12:24
  • Thank you so much! that seemed to make it work, except for 1 more error that occurs: " return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context) File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python/plugins\processing\core\Processing.py", line 130, in runAlgorithm if context.feedback() is None: AttributeError: 'bool' object has no attribute 'feedback'" What do they mean with "feedback" ? – Entropy125 Nov 15 '20 at 19:40

Your Answer

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

Browse other questions tagged or ask your own question.