8

I have read the questions and comments here: Splitting shapefile into separate files for each feature using QGIS

However, in my case, I don't have unique values for each polygon instead I have grouping variables.

A sample dummy data is that I have a vector layer with the field "forestClass" and in this field, my polygons have the following codes: 134,134,134,879,908,675,675,908,879,923,675,675.

I would need to get a polygon layer for each forest class, thus resulting in:

  • Polygon layer 1 with forestclass 134 and 3 polygons
  • Polygon layer 2 with forestclass 879 and 2 polygons
  • Polygon layer 3 with forestclass 908 and 2 polygons
  • Polygon layer 4 with forestclass 675 and 4 polygons
  • Polygon layer 5 with forestclass 923 and 1 polygon

Is there any ready solution for this in QGIS or dependencies? If not, is there someone who could guide me on how to do this?

After I get the subgroup vector layers I need to perform buffer/select by location and save intersect polygons to new layers. For this task, I am using processing/graphical-modeler and I have solved almost everything but splitting into subgroups is my pain now.

I have this situation with hundreds of polygons and it would not be efficient to do this regularly manually.

Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Oct 26, 2017 at 4:22

1 Answer 1

13

A little dig in the processing algorithms and you can find Split vector layer geoalgorithm.

It takes a vector layer and an attribute and generates a set of vector layers in an output folder. Each of the layers created in that folder contains all features from the input layer with the same value for the specified attribute.

The number of files generated is equal to the number of different values found for the specified attribute.*

First, choose the layer to proceed, then the field to use for grouping and Run.

It will generate as many files as you have unique values in your field, each file containing the associated features.

Taras
35.7k5 gold badges77 silver badges151 bronze badges
answered Oct 26, 2017 at 6:34
2
  • Thank you very much YoLecomte for your guidance. I did try the the split vector layer before posting the question but it did not worked. The Unique value I was using was a date like "2017年10月11日" . However I changed the variable to weeks like: 1,2,3 and the it did worked as expected. Commented Oct 27, 2017 at 14:43
  • Well, that's a good news! Commented Oct 27, 2017 at 15:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.