3

Is it possible for several QGIS layers to share a single attribute file, but each layer containing a different set of features from that one shapefile based on the value of an attribute?

4
  • Thanks for quick reply. When I duplicate the layer created in the first step ("field_name" = 'A'), it contains only the features with 'A' in that field. What I want to be in the second layer is those features in the original unfiltered file which had 'B' in that field.
    – Bill C
    Sep 23, 2020 at 11:30
  • Note that everything will be slower if you attempt this with a large shapefile (>100K rows), and you should certainly build indexes on the basis fields.
    – Vince
    Sep 23, 2020 at 11:30
  • Copying a layer copies its properties; you need to edit the layer properties for each layer.
    – Vince
    Sep 23, 2020 at 12:03
  • Perhaps it might be more intuitive, to duplicate the shapefile before creating any filters. Then filter each layer as needed.
    – Stu Smith
    Sep 23, 2020 at 15:09

1 Answer 1

6

Yes, you just need to add a filter (called a definition query in ArcGIS Desktop).

Say you have an attribute field "field_name" with values A, B, and C:

  • Add the shapefile
  • Open the shapefile's properties
  • In the Source tab, at the bottom right click the Query Builder button
  • Add the expression "field_name" = 'A'
  • This layer will now be filtered to only show featrues from that shapefile which have that attribute
  • Duplicate this layer and edit the filter as many times as you need to show the other attributes

Just note that any edits you make to one of those layers will affect the rest of the layers as you are editing the shared underlying data.

0

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.