On 15 February 2018 at 00:13, G. Allegri <gioha...@gmail.com> wrote:
> I'm trying to follow the code that produces the two return values from
> QgsProcessingLagorithm.parameterAsSink in Python. I can't find where the sip
> interface (or whatever) changes the API return value to the two returned
> values "sink" and "dest_id".
> Where does it happen?
This is the "destinationIdentifier" argument from the c++ API - sip
automatically converts arguments passed by reference like this into
return values. The PyQGIS docs show it a bit clearer.
> What does the second parameter (destination id) refer to?
Per the docs: "The destinationIdentifier argument will be set to a
string which can be used to retrieve the layer corresponding to the
sink,". It's a unique text identifier which processing uses to later
retrieve the result (and to pass on to following algorithms in a
model). The important thing here is that when your algorithm returns
its result dictionary, it should contain an entry for the output with
the corresponding destinationIdentifier as the value.
Here's a good example:
making the sink:
including it in the results:
> QGIS-Developer mailing list
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
QGIS-Developer mailing list
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer