I've a layer with multilines, overlapping to a various degrees. I need to merge/dissolve them "downwards" while summing their values for the overlapping segments.

I made it to "Union" phase, the resulting layer is here link, values to sum are in ROUND column. Following it, I tried v.clean and Aggregate (basically as suggested here Summing attribute values of overlapping polyline portions in QGIS 3.0.3 ), but I'm kinda confused in options, and have come to thinking, that these tools actually cannot do this.

The task seems quite simple, yet I`m quite new to GIS and might be wrong. Found this thread Overlapping line aggregation+trim in PostGIS, while summing values which talks about just the same situation but is really a code in length of an A4 really the only solution?

Here's a sample of what I'm trying to achieve. sample I`s an actual segment from data after Aggregation but tool gave wrong results with many lines still overlapping, still, the idea is right. As a result, I want to have a flattened layer of line segments without overlapping, where each segment, i.e. color in sample, has a value, that is a sum of values of overlapping segments before flattening.

Note - I`d prefer a solution over a calculated final result, as the source data are dynamic and keep changing.

Note 2 - gave a go to the code in length of an A4 suggested in the other thread. Changed variables everywhere in the code and tried to create a virtual layer with it. No luck, it returned syntax error, which I was unable to identify. No wonder as I'm a total dumb when it comes to SQL, well, code in general.

  • 2
    Can you add a screenshot showing the lines and attribute table, and you desired result (for example a paint drawing)
    – BERA
    Jan 9, 2022 at 9:25
  • Sure, sample added. Still, it's hard to demonstrate overlapping, but it's in the added .shp file. Attribute table contains I guess 5 columns one of which contains the values to sum. Too much hassle to screenshot it.
    – edge
    Jan 9, 2022 at 12:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.