2

I’m working with the Field Calculator in the Graphical Modeler and I’m stuck. I need to assign the feature id from a polygon layer (track) to a point layer (StopPoint) so that I can group together those points to later be connected by a line. The suggested expression works flawlessly in the Field Calculator from the toolbox but fails when run inside the Modeler. I get the error: Layer 'track' could not be loaded.

array_to_string (
    overlay_nearest( 
        'track',
        id
    )
)

Is there a solution to this problem, or a workaround using other algorithms in the modeler?

eTrack polygon with intersecting points

The dialog from the field calculator in the graphical modeler

4
  • Don't you have the track layer already loaded in QGIS, so it is not an output of the modeler? In this case: did you load the teack layer to the modeler? How looks your modeler window?
    – Babel
    Jan 21, 2021 at 19:19
  • The track layer is generated by the modeler.
    – user29934
    Jan 21, 2021 at 21:38
  • If I remember your setting well (gis.stackexchange.com/questions/383723/…), you have an initial track - not the one you're working with now, but very similar- especially the id you want to assign to the points should be the same, right? In fact, you could either use the original track (line) or the buffer (polygon) if they have a unique id. It is necessary only to group together the points so that they can be connected afterwards correctly. So using any kind of uniqe field from track should work. Do I miss something?
    – Babel
    Jan 21, 2021 at 21:49
  • The solution by MrXsquared sounds good and is maybe even easier: join attributes by nearest or join by location
    – Babel
    Jan 21, 2021 at 21:50

1 Answer 1

1

Using expressions requiring access to a temporary layer can currently not be used in graphical modeler, see https://gis.stackexchange.com/a/379831/107424. You can only access layers, that are added to your canvas.

However, as a workaround you can use processing tools such as "join attributes by nearest" or "join by location" for this and just concat your steps in the model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.