[QGIS-Developer] Iterate over layer features in a model - get_feature_by_id

Pedro Venâncio pedrongvenancio at gmail.com
Mon May 11 18:38:14 PDT 2020


Hi Nyall,

Thank you very much for the clarification! It seems a must have for the
next crowdfunding round!

I believe that the issue is the same or similar with the Iterate over the
layer, right?

Thanks again Nyall!

Best regards,
Pedro


Nyall Dawson <nyall.dawson at gmail.com> escreveu no dia terça, 12/05/2020
à(s) 02:21:

> On Tue, 12 May 2020 at 11:08, Pedro Venâncio <pedrongvenancio at gmail.com>
> wrote:
> >
> > Hi all,
> >
>
> >
> > However, I was trying to give a more generic use to the model, and so I
> added the 'Add geometry attributes' algorithm to it. With this, I cannot
> get the coordinates anymore with the expression:
> >
> > concat(attributes( get_feature_by_id(@Add_geometry_attributes_OUTPUT,
> 0))['xcoord'], ',', attributes(
> get_feature_by_id(@Add_geometry_attributes_OUTPUT, 0))['ycoord'])
> >
>
> > This can be due to the fact that the intermediate result of 'Add
> geometry attributes' is a memory layer? Is there any possibility of doing
> this in another way?
>
> No -- it's a limitation in models, that expressions CANNOT access
> layers which have been created during the model execution. Only layers
> present in the project at the start of the model execution can
> (currently) be utilised by expressions in a model.
>
> The fix is not trivial -- e.g. for myself I'd budget about 3 days to fix
> this.
>
> Nyall
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200512/fe849e43/attachment-0001.html>


More information about the QGIS-Developer mailing list