I have multiple (50) layers representing rivers and creeks which are polylines. However, they are broken into line segments so each river/creek layer might have 30 or so features within it.
I know how to select and merge features within 1 layer but is there a way in QGIS to do this as a batch process with all 50 layers?
Otherwise, I have to manually go through and merge each line layer separately.
Perhaps someones know of a script to perform this. The process for 1 layer is:
- open layer for editing
- open attribute table
- select all in table
- merge selected features
- close and save
Essentially I need to run these 5 processes on each of the 50 layers?
-
2Do your creeks have attributes like name, order, perennial etc that need to be kept? Merge is a term that is used for combining feature classes into a single one, the term which it sounds like you're after is dissolve, read more gis.stackexchange.com/questions/173446/… It might sound like nit-picking to suggest a different term but you will find searching for 'merge' gives different results to searching for 'dissolve'. Are you hoping to automate this with pyqgis?Michael Stimson– Michael Stimson2020年01月08日 04:09:17 +00:00Commented Jan 8, 2020 at 4:09
1 Answer 1
Have a look at the dissolve
tool. It dissolves/merges all features of a layer into a single multi-feature, or dissolves based on an attribute, e.g. the name of the rivers (no need for 50 separate layers next time).
As with most tools, you may start batch editing at the bottom left. When filling in the layers into the batch dialogue, make sure to select all of them, they'll be added at the bottom. No need to select a layer separately for each row.
-
1After batch-dissolving, you can use the
merge vector layers
tool to combine the dissolved streams into a single file.csk– csk2020年01月08日 17:13:43 +00:00Commented Jan 8, 2020 at 17:13 -
Awsome thats exactly the tool I neede csk!! Thank youJohnF– JohnF2020年01月09日 00:55:39 +00:00Commented Jan 9, 2020 at 0:55