[QGIS-Developer] using a features subset as an input for a processing alg

G. Allegri giohappy at gmail.com
Tue Sep 10 15:06:06 PDT 2019


Dear all,
I was confident that it would have been simple, while I can’t find the
proper way od doing that. Having a reference to a QgsVectorLayer, I would
need to use a subset of its features to run an algorithm down the line.
I hoped there was a way to define an input as afeature source with a filter
(QgsFeatureRequest or similar. I’ve tried using
QgsProcessingFeatureSourceDefinition with a selection but with no luck:

pointlayer.selectByRect(rect, QgsVectorLayer.SetSelection)

processing.run("qgis:voronoipolygons", {
         'INPUT': QgsProcessingFeatureSourceDefinition(
                    pointlayer.id(),
                    True),
         'BUFFER': 10,
         'OUTPUT': outpath})

error, can’t find the layer with that id, since it expects to find it
in the proje

Any ideas? Is it possible to build a QgsProcessingParameterDefinition
for the task?

Cheers,
Giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190911/f3874be5/attachment.html>


More information about the QGIS-Developer mailing list