2

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?

1
  • 2
    Do 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? Commented Jan 8, 2020 at 4:09

1 Answer 1

3

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.

2
  • 1
    After batch-dissolving, you can use the merge vector layers tool to combine the dissolved streams into a single file.
    – csk
    Commented Jan 8, 2020 at 17:13
  • Awsome thats exactly the tool I neede csk!! Thank you
    – JohnF
    Commented Jan 9, 2020 at 0:55

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.