3

I have several layers which have features with several parts. These parts are often overlapping however and as a result the Length of the feature is often not correct when I calculate it using $length.

I can manually split the features by using the Multipart into Singleparts tool, and check whether they overlap. In a next step I can simply delete the overlapping part.

In the picture you can see that I have split feature with number 7 (containing 8 parts) into several features. The selected feature (row 7) is highlighted in Yellow and the feature in row 6 is flashing in red and thus partly overlaps with the feature from row 7. I can now manually delete row 6, but to check this for 10.000 features is quite time consuming. I've tried the Dissolve function (after splitting multipart to singleparts), but it does not seem to remove overlapping parts of features for me. Is there another easy way to delete overlapping parts within each feature of a linestring layer?

Important note: Within the same layer there may be different features (with a different "number and/or OBJECTID") that overlap with each other as well. I do wish to keep these separate from each other and only to remove the overlap between parts within features.

enter image description here

EDIT: Still not solved. Here is the data: OverlappingLines IDs and length are at the end of the attribute table.

1
  • Which dissolve tool did you use? The dissolve tool in (GDAL-Vector Processing) offers many more options than the dissolve tool in Vector-Geometry.
    – John
    Apr 14, 2022 at 13:10

1 Answer 1

6
+50

I believe the issue is that the nodes of the different features are not coincidental.

I replicated your issue and was able to solve it by running Snap Geometries to Layer (Snap to anchor nodes) before undertaking Dissolve.

The workflow in your case will be as follows:

  1. Multipart to Singleparts
  2. Snap Geometries to Layer [set Behavior to: Snap to anchor nodes (single layer only)]
  3. Dissolve [set Dissolve field(s) to: number and/or OBJECTID]
  4. Calculate length using $length

Note: this will move the nodes of the input layer, you can set the acceptable tolerance in the Snap Geometetries to Layer tool

Snap and Dissolve Tool Settings: Snap and Dissolve Tool Settings Overlaps before and After (Symbolized by OBJECTID): Overlaps Before and After Non-Coincidental / Non-Overlapping Nodes of input: Non-Overlapping Nodes

4
  • The answer provided by Cushen seems to change the geometries and did unfortunately not solve my problem after all. I uploaded the data in the question @EDIT
    – Yelper
    May 6, 2022 at 6:44
  • The snapping tolerance is key to this, I tried using your data with a tolerance of 0.1 m which resulted in 697 features. Can you elaborate on what the issue is, can you give an example with a feature idnmb?
    – Cushen
    May 6, 2022 at 8:14
  • There are two issues. Firstly, the suggested method moves some of the lines. They don't move by much, but still they move. If you look at number 720 it shifts almost 1 cm at the top. The 1 cm perhaps wouldn't be an issue, but I could imagine that with future projects there might be bigger shifts. Secondly, with the dissolve function and these settings I lose some "cuts" in the lines that I don't always want too lose. Or by selecting Number and ID only I lose some info from the other attributes.
    – Yelper
    May 9, 2022 at 7:39
  • Perhaps I should have framed my question differently. I either want to remove the overlapping lines without removing too many cuts in the lines that already exists. Or I want to select/Identify all the overlapping parts without having to discover this manually by selecting and "flashing" them in the attribute table.
    – Yelper
    May 9, 2022 at 7:48

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.