[Qgis-user] Modeler: Using Vector field input with multiple fields

Bernd Vogelgesang bernd.vogelgesang at gmx.de
Mon Sep 14 03:19:19 PDT 2020


Figured it out:

The field names of a vector field input ("groupingfields") are stored as
an array. As I wanted to combine the values of those fields, I first had
to extract the fieldname from this array (e.g.
array_get(@groupingfields,0)), and then get the attribute for each
feature for this field attribute( array_get(@groupingfields,0))|

Doing the same for the second field and pasting them together gives my
new identifier field for my polygons in the field calculator:

  attribute( array_get(@groupingfields,0))||'_'|| attribute(
array_get(@groupingfields ,1))

Nice! Automation of atlas and afterwards world domination are at hand.



On 13.09.20 14:00, Bernd Vogelgesang wrote:
> Hi there,
>
> I am trying to use the "Vector Field" input with more than one field
> in a model for generating atlas zones:
> To create individual oriented bounding boxes over polygon sketches, I
> need to create an individual attribute for each polygon. The problem
> is that the individual distinction of a polygon is defined through at
> least  two fields (lets call them "location" and "zone")
> As the zone names get repeated over the different locations, only the
> combination of location and zone will identify the individual plot.
>
> In the vector field input, there is the possibility to mark multiple
> fields from a vector layer as input.
> My idea was now, to create a new field "combi" from the marked fields
> and use it to create my oriented boxes.
>
> The question is now, how the value in the multi-field input is stored
> and how I can extract the individual parts for usage in the field
> calculator.
> Given my vector field input is names "groupingfields", I can access it
> in the field calculator as @groupingfields.
>
> But how can I extract the values, so that in pseudocode the "combi"
> field expression will look like '@groupingfield[1] || '_' ||
> @groupingfield[2] (which of course does not work, thats why I'm asking) ?
>
> I case the question arises, why I do not simply create that
> combi-field beforehand for my polygons outside of the model: Simply, I
> do not want to. I want to be the master of my data, and not its slave ;)
>
> Thanx for any input,
>
> Bernd
>


More information about the Qgis-user mailing list