QGIS-processing extract by location: How to set the ParameterGeometryPredicate object

المشرف العام

Administrator
طاقم الإدارة
I try to use the processing 'qgis:extractbylocation' in QGIS 2.8.2 from the QGIS algorithm provider.

import processing# import the layers by a given uriinputlayer = QgsVectorLayer(uriTr.uri(), "inputlayer", "postgres")intersectlayer = QgsVectorLayer(uriOSM.uri(), "intersectlayer", "postgres")# initialize a predicate instancepred_intersects = processing.core.parameters.ParameterGeometryPredicate(enabledPredicates = 'intersects')# run the processingprocessing.runalg('qgis:extractbylocation', inputlayer, intersectlayer, pred_intersects, None)However I get the following error:

Traceback (most recent call last): File "", line 1, in File "~/.qgis2/python/plugins/processing/tools/general.py", line 71, in runalg alg = Processing.runAlgorithm(algOrName, None, *args) File "~/.qgis2/python/plugins/processing/core/Processing.py", line 317, in runAlgorithm if not param.setValue(args): File "~/.qgis2/python/plugins/processing/core/parameters.py", line 829, in setValue elif len(value) == 0:AttributeError: ParameterGeometryPredicate instance has no attribute '__len__'The algorithm needs the following inputs

processing.alghelp("qgis:extractbylocation") ALGORITHM: Extract by location INPUT INTERSECT PREDICATE OUTPUT ParameterGeometryPredicate is described here: https://fossies.org/dox/qgis-2.8.2/...parameters_1_1ParameterGeometryPredicate.html

How do I need to initialize a correct instance of the ParameterGeometryPredicate class?



أكثر...
 
أعلى