[GRASS-user] Criteria for v.clean tool=rmdangle

Markus GRASS markus.metz.giswork at googlemail.com
Thu Jun 18 15:15:22 EDT 2009

Dwight Needels wrote:
> A) It sometimes removes lines that are not part of a dangle in the
> original vector (line B in my test case). Specifically, if two branch
> points are connected by a short line, this connecting line may end up
> deleted as part of a newly created dangle. This probably won't happen
> very often without a very large or negative thresh, because it
> requires a single node with 3 short lines attached.
> D) Use of a negative threshold removes a somewhat surprising number of
> lines, but in a useful way (leaving loops and lines connecting loops).
> I have attached two screenshots showing this with my averaged GPS
> trail data (gray is original vector, red is vector after v.clean
> tool-rmdangle thresh=-1).
Useful to remove incorrect boundaries, e.g. in v.in.ogr.
> All of these quirks have the same underlying cause... the rmdangle
> tool does not remove all dangles in the original vector, it
> sequentially removes dangles one at a time and doesn't go back to
> lines it has already processed. If run repeatedly, the final vector
> will have no dangles shorter than threshold, but this is different
> than removing all of the dangles in the original. Perhaps this
> underlying behavior can be communicated with something like the text
> below.
> Existing text...
> "Threshold gives maximum line/boundary length in map units, degrees
> for latlon. Dangles shorter than thresh will be removed. All dangles
> will be removed if thresh < 0."
> Suggested text...
> "Threshold gives maximum line/boundary length in map units, degrees
> for latlon. Dangles shorter than thresh are removed sequentially.
> Lines that are not either part of a loop or connecting two loops will
> be removed if thresh < 0."
> And perhaps under Notes, something like...
> "The lines removed by the rmdangle tool will sometimes not be the same
> as the dangles in the original vector. For example, if the original
> vector has a node with two dangles shorter than threshold, one of them
> (the one with the larger internal Id) will not be deleted, because it
> is no longer part of a dangle. 
but only if the remaining dangle and the next line(s, depending if the
other end node has only one more line connecting to it) are together
longer than thresh.

Just to illustrate that it can become a bit much to explain every
conceivable situation and quirk A) would then need to be included too.
> If the tool is run repeatedly, the final vector will have no dangles
> shorter than thresh. 
Not so sure if repeated runs are necessary. One run should be enough to
have no dangles shorter than thresh in the output vector.
> To preferentially remove the shortest dangles, use a small thresh
> value in the first pass, and a larger value in the second pass."
Included in the manual with an example.

I have included some but not all of your suggestions because e.g. this
internal id thing is IMHO a bit too technical and not needed for running
the tool. Mentioning internal ids would suggest that they can be used by
the user which is the case for very few modules but not v.clean. The
internal id is nothing fixed, neither for lines nor for nodes, in
particular when using several cleaning tools in one go, internal ids are
constantly changed. Even nodes are a bit technical because they are no
regular vector object like point,line,boundary,centroid,area,face,kernel
but can be easily edited with the wxdigitizer or v.digit, so it would
hopefully be not too confusing to mention nodes.

Markus M

PS: I hope you have now the world's cleanest hiking trails:-)

More information about the grass-user mailing list