3

I have a LineString layer that I need to reduce the number of vertices. For example, some straight lines have intermediate vertices that add no value and should be removed. A slight loss of accuracy, as a result, is acceptable.

To my understanding the Simplify algorithm on QGIS is the perfect tool for this, however, no matter what I do, no vertices are removed when this tool is used. There are no errors in the log, and the execution seemingly succeeds.

What am I doing wrong? A piece I am testing can be downloaded here: https://easyupload.io/oivzk9

I use QGIS 3.28.0 but tried with 3.4.5 and 2.18.16 on another computer as well. The result is the same.

2
  • Please, specify which QGIS version you are using. Commented Jan 4, 2023 at 18:37
  • Ah, right. I use 3.28.0, but tried with 3.4.5 and 2.18.16 on another computer as well. Every time the result is the same. Added this to the main post. It seems like the problem is on my side, but I can't figure out what's wrong. Commented Jan 4, 2023 at 18:44

3 Answers 3

6

Your data contains 2212 features, each one having exactly two vertices: the start vertex and the end vertex. There is nothing to simplify as your data stand right now.

1
  • You're right, I simply did not understand how this tool works. My intention was to dissolve the layer to fewer multi linestring features and then simplify. Commented Jan 10, 2023 at 11:43
5

Since the QGIS version 3.26 the Dissolve tool has a new option: Keep disjoint features separate. Check this option; your line features will be reduced from 2,212 to 41 keeping the whole line structure the same.

Input:

enter image description here

Dissolve tool:

enter image description here

Output:

enter image description here

Finally, use the Simplify tool to simplify the line and reduce the number of vertices from 1,147 to less than 100. Adjust the tolerance based on your needs.

Before Simplification:

enter image description here

Simplify tool:

enter image description here

After Simplification:

enter image description here

7
  • That does decrease the number of features but they cannot be simplified any better. The result is a multilinestring with lots of two-vertex members. But that is a good start. With the "Merge lines" tool the multilinestrings can be converted into long lines with lots of vertices, and they can finally be simplified. Commented Jan 5, 2023 at 0:38
  • @user30184 The new Keep disjoint features separate option acts exactly as if you have used the Merge lines tool. It creates lines with many vertices connected together (two steps in one step). Commented Jan 5, 2023 at 0:54
  • All right, I have only QGIS 3.28.1 at the moment. But the name of the option might be improved, it does not tell that the new option performs both dissolve/union and merge. Please simplify the result with a tolerance of 1 and tell how many vertices are left on the layer. I have 87 after old dissolve + merge + simplify. Commented Jan 5, 2023 at 1:07
  • @user30184 Using the new Keep disjoint features separate option + simplify I got 87 vertices. This means the new Dissolve option acts as dissolve + merge lines together. So it is two steps in one step, as I said in my previous comment Commented Jan 5, 2023 at 6:31
  • 1
    Perfect, this is the true solution. Commented Jan 10, 2023 at 11:46
4

Use Dissolve tool to get one geometry. Then use Simplify tool with Tolerance:0.5 (m). Try different tolerance values and check the results.

1
  • Indeed dissolving geometries correctly was the key here. The other answer explains it in more detail. Commented Jan 10, 2023 at 11:45

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.