[GRASS-user] Criteria for v.clean tool=rmdangle
Dwight Needels
needels at translucida.com
Wed Jun 17 14:20:05 EDT 2009
On Jun 17, 2009, at 11:13 AM, Markus GRASS wrote:
> Maybe start with a lower threshold first, e.g. 5 ft to remove D and E
> first, then increase the threshold for any other, longer dangles you
> would like to remove
This is exactly what I ended up doing, and it works great. The only
question is how fine a distinction I want to make (do I really care if
it removes a 25 ft dangle while leaving a 30 ft dangle or removes a 5
ft while leaving a 10 ft?). For my GPS tracks I ended up running
v.clean tool=rmdangle three times with threshold of 10, 20 and 30 ft.
>> It may be worth having a note called "What is a dangle?", but
>> regardless it would be good to have a statement that says something
>> like...
>>
>> "The rmdangle tool processes dangles sequentially by internal Id,
>> which may result in short lines with high Id values remaining after
>> lines with lower Id values have been deleted from the nearest branch
>> point."
>>
>> Does any of this look incorrect? Can the processing by internal Id be
>> confirmed?
> According to the source code, the rmdangle tool processes nodes by
> internal id, not lines. As soon as it finds a node with only one line
> connected, it looks at the length and the other end node. If only one
> other line is connected at that other end node, the length of that one
> is added. That continues until a node is found with more than two
> lines
> of the desired type connecting to it. If the accumulated length is
> smaller than threshold or threshold is < 0, all lines from the start
> node up to that node are removed.
>
> I have updated the manual in grass-6.4.svn, please have a look at it
> [1]
> and give feedback if it is now better explained what the different
> tools
> do. You can safe a local copy of the html file for nicer display. I
> did
> not modify the tooltip description in the GUI, that's long enough
> already.
>
> [1]
> https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/vector/v.clean/description.html
>
> Markus M
I looked at the updated manual, and I like the description for the
rmdangle tool (big improvement). There are several somewhat surprising
(but predictable) behaviors that it might be useful to point out.
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.
B) It sometimes doesn't remove lines that are part of a dangle in the
original vector (line E in my test case). Specifically, 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.
This will only happen where there is a single node with 2 short lines
attached (e.g. near a terminus).
C) It sometimes ends up with a vector that still has dangles, which
require a second pass (and, conceivably even a third pass).
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).
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. If the tool is run repeatedly, the
final vector will have no dangles shorter than thresh. To
preferentially remove the shortest dangles, use a small thresh value
in the first pass, and a larger value in the second pass."
Thanks, -Dwight
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rmdangles_all_blue_blazed.png
Type: image/png
Size: 5187 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20090617/c4a4491e/rmdangles_all_blue_blazed.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rmdangles_all_unblazed.png
Type: image/png
Size: 8070 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20090617/c4a4491e/rmdangles_all_unblazed.png
More information about the grass-user
mailing list