<div dir="ltr"><div><div><div><div><div><div>Hi Salvatore,<br><br></div>I already tried to use<br><br></div>blayer = area_result['OUTPUT']<br></div>for feat in blayer.getFeatures():<br>    ....<br><br></div>with no success . If I do so I get<br>

<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(255,0,0)">AttributeError: 'str' object has no attribute 'getFeatures' </span></p><br></div>There must be a way to transforme this string representing the layer as a processing layer object....<br>I use this code inside the processAlgorithm method of my QgsProcessingAlgorithm class.<br><br><br></div>Michaël<br></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-15 22:39 GMT+01:00 Salvatore Larosa <span dir="ltr"><<a href="mailto:lrssvtml@gmail.com" target="_blank">lrssvtml@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Michaël,</span><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Feb 15, 2018 at 6:36 PM, kimaidou <span dir="ltr"><<a href="mailto:kimaidou@gmail.com" target="_blank">kimaidou@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hi all,<br><br></div>I have a simple processing python alg which <br>* generates a buffer with qgis:buffer<br>* use qgis:fieldcalculator to add an buf_area field -> the output vector of my alg is this buffer+new field.<br><br>I would like to parse the features of the output vector in order to gather some information and put it in a new string output. I have not been able to get the layer object to perform a getFeatures on it.<br><br></div>See the code<br><a href="http://paste.debian.net/1010463/" target="_blank">http://paste.debian.net/101046<wbr>3/</a><br><br></div>In line 32, my blayer is None<br></div>I think I am not using the good way to get the output vector layer features? I tried to use the same way as for reading an input layer, but oviously it is different.</div></div></div></blockquote><div><br></div></span><div>What does happen if you put area_result['OUTPUT'] directly instead of self.parameterAsSource? </div><div>parameterAsSource() accept a parameter as first argument and area_result should be already un QgsVectorLayer.</div><div><br></div><div>Where you are trying to execute it from?</div></div><span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div class="m_2517701159849887442gmail_signature" data-smartmail="gmail_signature">Salvatore Larosa<br>linkedIn: <a href="http://linkedin.com/in/larosasalvatore" target="_blank">http://linkedin.com/in/<wbr>larosasalvatore</a><br>twitter: @lrssvt<br>skype: s.larosa<br>IRC: lrssvt on freenode<br></div>
</font></span></div></div>
</blockquote></div><br></div>