2

I have a single layer of points I need to split into separate layers based on the unique ID. Below is an example of how the points are labeled. First digit is the feature number and after the decimal is a point along that feature. I'd like to separate them based on the feature number (e.g. all points for Feature 1 (1.1,1.2,1.3) are on a separate layer).

1.1
1.2
1.3
2.1
2.2
2.3
2.4
2.5
3.1
3.2
0

3 Answers 3

2
  1. (Assuming you already have latitude and longitude captured in the .dbf)Export the file to .csv using "save as" or MMQGIS.

  2. Load the data to a spread sheet editor like Open Office or Excel.

  3. Duplicate the ID field.

  4. Split the duplicated column into two columns using '.' as the delimiter. You can delete the data that cam after the '.'.

  5. load the file back into QGIS.

  6. Save as shapefile.

  7. Use the split vector layer tool to split the layer by the values you created.

2

There is exactly function Split vector layer in processing toolbox. You have to only set input layer, ID field and output direcotry where will be new layers created.

enter image description here

From QGIS version 2.16 you can run this function also from menu Vector --> Data Management Tools --> Split vector layer

2

I suppose your underlying question is how to put your "id" field (1.1 ~ x.x) to "group" (1 ~ x) and split it by group. (This issue was addressed by Kingfisher).

My suggestion is to add a new field, say "group" (integer), by Field Calculator with an expression:

left("id", strpos("id", '[.]')-1)

This will extract the numbers before dot (.).

Then use Split vector layer tool using "group" as suggested by Oto.

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.