<div dir="ltr"><div><div><div><div><div>Thanks Nyall,<br><br></div>Our posts crossed !<br><br></div>Ok for the shortcut and the getMapLayer method.<br><br></div>One question : in my alg, if I use QgsProcessingParameterFeatureSource instead of QgsProcessingParameterVectorLayer for my input, can I still use mapLayerFromString and the getFeatures, or is there a featureSourceFromString which allows me to loop through the features ?<br><br></div><div>MichaĆ«l<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-16 7:22 GMT+01:00 Nyall Dawson <span dir="ltr"><<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 16 February 2018 at 04:36, kimaidou <<a href="mailto:kimaidou@gmail.com">kimaidou@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> 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<br>
> my alg is this buffer+new field.<br>
><br>
> I would like to parse the features of the output vector in order to gather<br>
> some information and put it in a new string output. I have not been able to<br>
> get the layer object to perform a getFeatures on it.<br>
><br>
> See the code<br>
> <a href="http://paste.debian.net/1010463/" rel="noreferrer" target="_blank">http://paste.debian.net/<wbr>1010463/</a><br>
><br>
> In line 32, my blayer is None<br>
> I think I am not using the good way to get the output vector layer features?<br>
> I tried to use the same way as for reading an input layer, but oviously it<br>
> is different.<br>
<br>
</span>blayer = QgsProcessingUtils.<wbr>mapLayerFromString( area_result[ 'OUTPUT'<br>
]), context )<br>
<br>
I'm thinking of adding a shortcut for this to the context, e.g.:<br>
<br>
blayer = context.getMapLayer( area_result['OUTPUT'] )<br>
<br>
What do you think?<br>
<span class="HOEnZb"><font color="#888888"><br>
Nyall<br>
</font></span></blockquote></div><br></div>