4

I need help with fixing my two dangle-errors: enter image description here

there are 2 dangles on the top right and one small hole on the top-left corner. enter image description here

I can deduct them with the Geometry Checker, but I cannot fix it (automatically).

This is only an example-file. I need the skill for a big file with hundreds of lines that need fixing before polygonizing...

Has someone an idea why v.clean (I ticked line and break, snap, rmdangle with tresholds 0,5,5) or geometry fixer cannot do that?

I already studied useful information like that:

... but still it is not working.

Taras
  • 32,823
  • 4
  • 66
  • 137
Carina
  • 157
  • 7
  • 0,5,5? Are they thresholds? 0 sounds wrong. Change it to the amount that things can move. Like 1 metre, for example. Lat long data will use smaller numbers. – wingnut Apr 27 '21 at 10:42
  • as far as I know it is only a dummy for "break" – Carina Apr 27 '21 at 11:01
  • I added a solution. However, Lines to polygons can handle lines that are not closed. Maybe you can explain why you first need to close the lines? – Babel Apr 27 '21 at 12:27
  • 1
    Without knowing the coordinate system units and the distances involved it is hard to say if there is a problem. In terms of dangles "The rmdangle tool deletes a dangle if the (combined) length is shorter than thresh or thresh < 0. If the combined length is larger than thresh, nothing is deleted" so your dangles may have exceeded the threshold and would remain. If the corner gap is larger than your snap tolerance then that would be unaffected. I usually set a v.in.ogr snap tolerance too. If you used the polygonize tool to create polys the dangles wouldn't matter but closing the gap would. – John Apr 27 '21 at 13:16
  • I want to use poligonize later. I tried it, but it made too much and wrong polygons. Thats why I try to clean the line first. I tried any dimension of thresh, but still no solution with v.clean... – Carina Apr 29 '21 at 07:15
  • If the provided answer solved your problem, would you mind marking it as accepted answer? If it didn't you could add a comment how it didn't. This would help other people provide a better answer, the poster of the answer to adapt the answer and it would help others with the same problem as yours to better contextualize the answer in terms of usability. My guess from your screenshots is that the answer by Babel solves another problem, but not what you asked for. This is why I wrote this comment. Is that correct? – thymaro Sep 18 '21 at 08:31
  • 1
    It's hard to see in the scaled down screenshots, but I guess your scale is larger than 1:10000. This would mean that the snap and rmdangle tolerances are not adapted to your circumstances. Instead of 0,5,5 you could try larger values. The Zero is ok, though, since 0 is a dummy value for the break tool, as far as I know. – thymaro Sep 18 '21 at 08:34

1 Answers1

3

You can use QGIS expressions with Geometry Generator or Geometry by expression for this - see here for details about these two options. In both cases, simply use this expression: close_line( $geometry).

Screenshot: Blue=original line; red=line created with the above expression: enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
  • Will Geometry Generator permanently fix such problems, so that if in the future the line layer were added to a new QGIS project the gap would be closed? Or is G.G. a temporary "cosmetic" fix for the current project only? – Stu Smith Apr 27 '21 at 17:59
  • 1
    Geometry generator is for visualization purpose only and does not create actual gemetries. If you need actual geometries, this can be done with Geometry by Expression- it will create a new layer with permanenrly stored lines. In both cases, use the same expression. See the link in my answer for more details. – Babel Apr 27 '21 at 18:44
  • Thank you! That helped for the holes : ) – Carina Apr 29 '21 at 07:13
  • Great. As a new user please note that this site tries to avoid thank you messages. You have the possibility instead to upvote and/or accept (hit the checkmark) a helpful answer. – Babel Apr 29 '21 at 16:18