3

I am building a modeler in QGIS 3.2.1, I want to use Refactor fields tool to change the name of a fixed field (fid to org_fid),This tool accepts a Fields mapping. I also noticed that there is a Fields Mapper type parameter in the QGIS Parameters. If I add a Fields Mapper type parameter to the Modeler, I can specify this parameter in the Fields mapping of the tool. But I don't know how to specify fid to org_fid.

I wonder if anyone can provide an example of using Fields Mapper in the modeler.

2
+50

It's quite simple. In the modeler there must be a vector input, a Fields Mapper and a refactor field at least. The refactor field will receive both files.

enter image description here

Set the Fields Mapper on Fields mapping box.

enter image description here

When you run, you can set the output file columns as you like, similar to MrXsquared's response, but the fields are not fixed, they can be redefined on each run.

enter image description here

Note that it is possible to map one layer and refactor on another. As long as it has the information it needs to obey the rules you put in.

  • 1
    This is good, I'll award it the bounty once the time limit passes. I'm still wondering though, is this the only algorithm that can use the Field Mapper? Specifically I'm thinking about this question, where they want to use the Field Calculator on all the fields in a layer with an unknown number of fields. Can the Field Mapper be used to set up the fields that go into the Field Calculator? gis.stackexchange.com/q/338972/81764 – csk Oct 18 at 14:06
  • It's not possible. The field calculator receives only one field, in which case it is possible to perform most of the functions through the refactor itself or the aggregate functions through the "Aggregates", which also receives the fields mapper. – Herbert Santos Oct 18 at 14:35
0

I did something similar in 2.18, adding a field consisting of two columns and then deleting these columns, all based on the vector table tools.

  • Thanks @Erik, I know this method, but I want to know how to use Fields Mapper in QGIS 3.2.1, because there is no real meaning to add an empty Fields Mapper. – T J Aug 9 '18 at 14:02

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.