3

I am trying to find out if there is a way - or even an algorithm in QGIS - that enables you to effectively create a new feature layer that is a copy of an original layer but with only a selection of key fields that one might want to limit the layer to, for further analysis.

In other words, my original layer has, for example, 30 columns or fields but I want to make a copy of that layer that only has 6 of those fields retained within it. I am working with QGIS 3.14

2
  • Try Refactor fields. I usually write a small python script to enable/disable the fields since using the GUI takes require some work with many fields
    – Bera
    Commented Nov 19, 2020 at 14:22
  • Please, do not forget about "What should I do when someone answers my question?"
    – Taras
    Commented May 9, 2022 at 11:01

1 Answer 1

8

The export / save layer as dialog provides a list of fields where users can chose which fields should be included in the export.

To reproduce this in a Processing model, you can use the "Drop Field(s)" tool:

enter image description here

5
  • Thanks for this. Is there a way of incorporating this into a model within the graphical modeller tool of QGIS. I guess I can create the layers as I wish to have them prior to bringing them into the modeller but I hoped there might be a process I could use within the model itself
    – TrevP
    Commented Sep 6, 2020 at 13:44
  • 1
    @TrevP yes, the tool is called "Drop Field(s)"
    – underdark
    Commented Sep 6, 2020 at 13:52
  • Perfect thanks. I may be looking at buying a copy of your book to bring me on a bit. I'm struggling with the syntax to use to get the fields to drop within the modeller but will keep working on it
    – TrevP
    Commented Sep 6, 2020 at 14:16
  • 2
    @TrevP You're welcome. There's really no book though that can keep up with all the Processing tools. Therefore it mostly comes down to screening the related Processing tool boxes, checking the documentation, and asking questions where necessary.
    – underdark
    Commented Sep 6, 2020 at 15:03
  • Thanks for that advice. I am a bit of a newbie at this level, beyond the front end stuff.
    – TrevP
    Commented Sep 6, 2020 at 15:35

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.