<div dir="ltr"><div>Hi, <br></div><div><br></div><div>I had the same issue. I had to loop over the output vector layer (child alg) to feed the sink (main alg). Maybe is not the simpliest/shortest/fastest, but it works.</div><div>Something like that :</div><div><br></div><div>o <span class="gmail-im">= processing.run(<br>
            'qgis:pointsalonglines', <br>
            params, context=context, feedback=feedback<br>
        )['OUTPUT']</span>

<br></div><div><br></div><div> (sink, dest_id) = self.parameterAsSink(</div><div>                    parameters,<br>                    self.OUTPUT,<br>                    context,<br>                    o.fields,<br>                    o.wkbType(),<br>                    o.sourceCrs()<br>)</div><div><br></div><div>for f in o.getFeatures()</div><div>    sink.addFeature(f)</div><div><br></div><div><br></div><div>return {'OUTPUT':dest_id}<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-06-29 9:35 GMT+02:00 Frank Broniewski <span dir="ltr"><<a href="mailto:hallo@frankbroniewski.com" target="_blank">hallo@frankbroniewski.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nyall,<br>
<br>
thanks a ton for your response. I am well know for making things tricky for myself 😃<br>
Anyway, my testing-algorithm-script is still not working. It runs through, but I do not get the expected result loaded into the layer tree. I suppose it runs through - the  output from the 'qgis:pointsalonglines' is a QgsVectorLayer - but after finishing I get nuthink back.<br>
<br>
Here's my complete script: You'll need a temporary polygon layer in a projected CRS (I use EPSG:31466) for it to work nicely. Copy & Paste it into a new script window and run it. I simply don't find the reason why the point result layer isn't loaded into my layer tree ...<br>
<br>
<br>
from qgis.PyQt.QtCore import QCoreApplication<br>
from qgis.core import (QgsApplication,<br>
                       QgsProcessing,<br>
                       QgsFeatureSink,<br>
                       QgsProcessingAlgorithm,<br>
                       QgsProcessingParameterFeatureS<wbr>ource,<br>
                       QgsProcessingParameterNumber,<br>
                       QgsProcessingParameterFeatureS<wbr>ink)<br>
<br>
import processing<br>
<br>
<br>
class PolygonCenterline(<wbr>QgsProcessingAlgorithm):<br>
<br>
    INPUT = 'INPUT'<br>
    DISTANCE = 'DISTANCE'<br>
    OUTPUT = 'OUTPUT'<br>
<br>
    def tr(self, text):<br>
        return QCoreApplication.translate('<wbr>Processing', text)<br>
<br>
    def createInstance(self):<br>
        return PolygonCenterline()<br>
<br>
    def group(self):<br>
        return <a href="http://self.tr" rel="noreferrer" target="_blank">self.tr</a>('Cartography')<br>
<br>
    def groupId(self):<br>
        return 'cartography'<br>
<br>
    def name(self):<br>
        return 'polygoncenterline'<br>
<br>
    def displayName(self):<br>
        return <a href="http://self.tr" rel="noreferrer" target="_blank">self.tr</a>('Calculate a polygon centerline')<br>
<span class=""><br>
    def initAlgorithm(self, config=None):<br>
        self.addParameter(<br>
            QgsProcessingParameterFeatureS<wbr>ource(<br>
                self.INPUT,<br>
                <a href="http://self.tr" rel="noreferrer" target="_blank">self.tr</a>('Vector Polygon Layer'),<br>
                [QgsProcessing.<wbr>TypeVectorPolygon]<br>
            )<br>
        )<br>
<br>
        self.addParameter(<br>
</span>            QgsProcessingParameterNumber(<br>
                self.DISTANCE,<br>
                <a href="http://self.tr" rel="noreferrer" target="_blank">self.tr</a>('Point distance value'),<br>
                type=<wbr>QgsProcessingParameterNumber.<wbr>Double,<br>
                minValue=10.0<br>
<span class="">            )<br>
        )<br>
<br>
        self.addParameter(<br>
            QgsProcessingParameterFeatureS<wbr>ink(<br>
                self.OUTPUT,<br>
                <a href="http://self.tr" rel="noreferrer" target="_blank">self.tr</a>('Center line')<br>
</span>            )<br>
        )<br>
<span class=""><br>
    def processAlgorithm(self, parameters, context, feedback):<br>
</span>        # qgis:pointsalonglines<br>
<span class="">        params = {<br>
            'INPUT': parameters[self.INPUT], <br>
</span>            'DISTANCE': parameters[self.DISTANCE],<br>
<span class="">            'START_OFFSET': 0,<br>
            'END_OFFSET': 0,<br>
            'OUTPUT': 'memory:'<br>
        }<br>
</span><span class="">        points = processing.run(<br>
            'qgis:pointsalonglines', <br>
            params, context=context, feedback=feedback<br>
        )['OUTPUT']<br>
<br>
        return {self.OUTPUT: points}<br>
<br>
<br>
<br>
<br>
</span>-----Ursprüngliche Nachricht-----<br>
Von: Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com">nyall.dawson@gmail.com</a>> <br>
Gesendet: Freitag, 29. Juni 2018 01:04<br>
An: Frank Broniewski <<a href="mailto:hallo@frankbroniewski.com">hallo@frankbroniewski.com</a>><br>
Cc: qgis-user <<a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a>><br>
Betreff: Re: [Qgis-user] QGIS 3 Processing question<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, 29 Jun 2018 at 07:14, Frank Broniewski <<a href="mailto:hallo@frankbroniewski.com">hallo@frankbroniewski.com</a>> wrote:<br>
><br>
>     def processAlgorithm(self, parameters, context, feedback):<br>
<br>
<br>
You're making this tricky for yourself! Cut out everything in processAlgorithm related to self.INPUT, and just pass the parameter value direct to the child algorithm to handle:<br>
<br>
>         params = {<br>
><br>
>             'INPUT': parameters[self.INPUT],<br>
><br>
>             'DISTANCE': pt_value,<br>
><br>
>             'START_OFFSET': 0,<br>
><br>
>             'END_OFFSET': 0,<br>
><br>
>             'OUTPUT': 'memory:'<br>
><br>
>         }<br>
<br>
<br>
Nyall<br>
</div></div><br>______________________________<wbr>_________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-user</a><br></blockquote></div><br></div>