<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Yes, that is the method I am looking for. Thank you, Etienne.<br>
</p>
<p>I am still curious why the output is different depending on the
isChildAlgorithm parameter??</p>
<p>Simon</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 24.11.2021 um 12:50 schrieb Etienne
Trimaille:<br>
</div>
<blockquote type="cite"
cite="mid:CAMtDFLL9O=u8ohUytMK+tZ1gS78RUz3VXahourB_OuBXzuO=Lw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>This might help you ?</div>
<div>QgsProcessingUtils::mapLayerFromString()<br>
</div>
<div><a
href="https://qgis.org/api/classQgsProcessingUtils.html#aa1c2360e52d2ed8100faf02a35125b17"
moz-do-not-send="true" class="moz-txt-link-freetext">https://qgis.org/api/classQgsProcessingUtils.html#aa1c2360e52d2ed8100faf02a35125b17</a></div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le mer. 24 nov. 2021 à 11:19,
Simon Gröchenig <<a
href="mailto:simon.groechenig@salzburgresearch.at"
moz-do-not-send="true" class="moz-txt-link-freetext">simon.groechenig@salzburgresearch.at</a>>
a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hi developers,</p>
<p>I am developing a Python processing algorithm with some
child algorithms. I am struggling to find a way to access
a child algorithm's output vector layer. I want to use
isChildAlgorithm=True in order to correctly set the
feedback progress.<br>
</p>
<p>* If I use processing.run(...) with setting the parameter
isChildAlgorithm to False (= default), the vector layer
(via sink) is returned as a QgsVectorLayer.<br>
* If I set isChildAlgorithm to True, only the dest_id is
returned as a string. I did not find a solution on how I
retrieve the corresponding QgsVectorLayer.<br>
* Is it intentional that the vector layer is returned as
QgsVectorLayer or str (dest_id), depending on the
isChildAlgorithm parameter?<br>
* How can I access output QgsVectorLayer from a child
algorithm?<br>
</p>
<p>This is a minimum example where you can modify the
is_child_algorithm parameter:</p>
<p>parameters = {<br>
'INPUT': QgsVectorLayer('Point?crs=epsg:31258',
'locations', "memory"),<br>
'DISTANCE': 10,<br>
'OUTPUT': 'TEMPORARY_OUTPUT'<br>
}<br>
result = processing.run("native:buffer", parameters,
is_child_algorithm=False )<br>
vector_layer = result['OUTPUT']<br>
print(str(type(vector_layer)))</p>
<p>Best regards<br>
Simon<br>
</p>
<pre cols="72">--
Simon Gröchenig MSc
MTA - Mobility & Transport Analytics
Salzburg Research Forschungsgesellschaft mbH
Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
T: +43.662.2288-314
<a href="mailto:simon.groechenig@salzburgresearch.at" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">simon.groechenig@salzburgresearch.at</a>
<a href="http://www.salzburgresearch.at" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">http://www.salzburgresearch.at</a></pre>
</div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a
href="https://lists.osgeo.org/mailman/listinfo/qgis-developer"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a
href="https://lists.osgeo.org/mailman/listinfo/qgis-developer"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Simon Gröchenig MSc
MTA - Mobility & Transport Analytics
Salzburg Research Forschungsgesellschaft mbH
Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
T: +43.662.2288-314
<a class="moz-txt-link-abbreviated" href="mailto:simon.groechenig@salzburgresearch.at">simon.groechenig@salzburgresearch.at</a>
<a class="moz-txt-link-freetext" href="http://www.salzburgresearch.at">http://www.salzburgresearch.at</a></pre>
</body>
</html>