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

Markus GRASS markus.metz.giswork at googlemail.com
Sun Jun 14 03:00:31 EDT 2009

Dwight Needels wrote:
> The rmdangle tool in v.clean usually behaves exactly the way I would
> expect it to, but occasionally it does not.
> I have a vector generated from a raster using r.thin and r.to.vect
> that has numerous dangles. In the attached screenshot there are what
> appear to be two dangles with lengths of ~2 and ~5 ft. The two
> terminal polylines of what appears to be the core vector are 16 ft and
> 11 ft (27 ft combined). The pre-clean vector is gray, the cleaned
> vector is red, vertices are displayed as points derived using
> v.to.points.
> After running v.clean tool=rmdangle thresh=30 the resulting vector (in
> red) removes one of the dangles plus what appears to be the two
> terminal polylines of the core  vector, while leaving the smaller
> dangle attached. I tried running v.edit tool=merge or
> v.build.polylines before cleaning, but got the same results.
> How does v.clean decide which line segment to remove as a dangle? Is
> there a way to force it to remove the line segment that leaves the
> longest possible remaining vector?
AFAIU, tool=rmdangle does not remove line segments, it only removes
whole lines. In GRASS terminology, a line has two end nodes, any number
of vertices and (n vertices - 1) segments. In your case, it may be
necessary to snap lines first, then break lines at intersections, then
remove dangles. Something like v.clean tool=snap,break,rmdangle

v.build.polylines would rather prevent tool=rmdangle to find anything to
> My workaround has been to run v.clean repeatedly with increasing
> thresholds, which I think removes the shortest line segment on each pass.
As above, tool=rmdangle shouldn't remove line segments, only complete lines.

BTW, have you tried r.to.vect on the original GPS tracks, then
v.generalize, instead of r.buffer/r.grow/r.thin?

Markus M

More information about the grass-user mailing list