My script has a single point input layer that will be processed with some logic to extract just some points.
I'd like to pass these extracted points as input of another algorithm (simple buffer) within the same scripts.
I define the final output as QgsProcessingParameterFeatureSink
:
self.addParameter(QgsProcessingParameterFeatureSink(
self.OUTPUT,
"Extracted points",
QgsProcessing.TypeVectorPoint
)
)
....
(sink, dest_id) = self.parameterAsSink(
parameters,
self.OUTPUT,
context,
source.fields(),
source.wkbType(),
source.sourceCrs()
)
running some logic to extract some points:
features = source.getFeatures()
for current, feat in enumerate(features):
if feat.geometry().asPoint() == maximum:
sink.addFeature(feat, QgsFeatureSink.FastInsert)
then I'm trying to call the buffer algorithm:
buffer = processing.run(
"native:buffer", {
'INPUT': sink,
'DISTANCE': distance,
'SEGMENTS': 5,
'END_CAP_STYLE': 0,
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'DISSOLVE': False,
'OUTPUT': 'memory:'
}
)
but it does not accept the input:
Incorrect parameter value for INPUT