3

I have read the question and comments on:

Splitting shapefile into separate files for each feature using QGIS/GDAL/SAGA? that can be seen here: Splitting shapefile into separate files for each feature using QGIS/GDAL/SAGA?

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

A sample dummy data is that I have a vector layer with 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 polygons

Is there any ready solution for this in QGIS or dependencies? and If not, is there someone that could guide me 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 the splitting into subgroups is my pain now.

I have this situation with hundred of polygons and it would not be efficient to do this on a regular basis manually.

5

A little dig in the processing algorithms and you can find:

Split vector layer This algorithm 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 field to use for grouping and Run.

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

  • 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. – BlueFish Oct 27 '17 at 14:43
  • Well, that's a good news! – YoLecomte Oct 27 '17 at 15:28

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.