1

I'm trying to use the Modeler to format a vector layer input with an attribute table to a new vector layer with the same attribute table, but where the column names are standardised. The point of this process is to use another (later) model to calculate the values with the standardised attribute names.

The attribute table that goes into the first (format) model might have different attribute names each time and I want to avoid having to build a new model with new definitions each time. So the name for the height of the building might be different.

input attribute table 1 height
10
5
input attribute table 2 build_height
5
6

Now I want to format the table to my standard of "height_building", so that I can use "height_building" for further calculations.

output attribute table 1 height_building
10
5
output attribute table 2 height_building
5
6

We can use a drop down menu to specify the input layer. But can we also do the same for single attributes once we have already selected the input layer?

The process would basically be:

  1. Select input layer

2.1 Select input attribute with drop down menu from input layer to be converted to "height_building"

2.2 Select input attribute with drop down menu from input layer to be converted to "(other attributes)"

  1. Output the new attribute table
1
  • 2
    ModelBuilder is for repetitive tasks. If you don't need to do this one-off task repeatedly, then you should just create a nominal template feature class and use Append with column mapping to rename the column(s).
    – Vince
    Oct 30, 2023 at 12:09

1 Answer 1

0

I think I have found a workaround/solution by using the "field mapper" input in conjunction with "refactor fields" and apply both to my input layer.

In my case, it's then followed by the "retain fields" algorythm, which allows me to drop the attributes that don't match my desired naming scheme.

I will have to check if it's possible to also attach my calculations to this model and rerun them on the newly generated layer (to account for manual overwrites) without messing everything up.

EDIT: This is how it looks like at the end. model structure

field mapper

The top left yellow input (Eingabe) is my input vektorlayer/shapefile with my unformatted attributes. The field mapper is used to map the "wrongly" named attributes to my chosen attribute names. both are attached to the refactor fields algorythm. Behind that is the retain fields algorythm, where I (pre-)specified which attributes with my chosen names are too keep. Because of this, I only need to assign the right attribute names for the things I'm interested in and can ignore the others.reassigning attribute names Once all that has processed, I add other attribute names for my template table, like "ID" and "Typ". The finished table keeps my renames attributes and the new ones I added through the field calculator.

2
  • Can you provide more details, show the resulting model? The idea of this site is to create reproducable solutions that can help others with similar problems.
    – Babel
    Oct 31, 2023 at 13:46
  • @Babel I added a more in depth explanation in my edit.
    – Balb31
    Nov 2, 2023 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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