[GRASS-dev] Re: [GRASS-user] v.clean tool=prune -
'thresh' interpreted wrong?
Maciej Sieczka
tutey at o2.pl
Tue Oct 3 12:41:32 EDT 2006
Moritz Lennert wrote:
> Maciej Sieczka wrote:
>> Moritz Lennert wrote:
>>
>>> http://freegis.org/cgi-bin/viewcvs.cgi/grass6/lib/vector/diglib/prune.c?rev=HEAD&content-type=text/vnd.viewcvs-markup
>>>
>>>
>>>
>>> There is an explanation of the algorithm at the beginning.
>>
>> Thanks, I should have looked into the source code first. My only
>> (poor) excuse is being a non-programmer and "mentally handicapped"
>> due to my disgraceful pre-Linux/FOSS times ;).
>>
>> Moritz suggested that maybe "the threshold only applies in cases
>> of change of direction (i.e. angles)". Please note there is no any
>> reference to angles or direction in the code or comments. It
>> seems the threshold refers to distance only.
>>
>> There is a following comment:
>>
>> * thresh - the distance that a string must wander from a straight
>> * line before another point is selected.
>>
>> As I understand it, this means that if my vertcices are on a
>> straight line, at intervals of 10, only a thresh of 10 or more
>> should prune them. But, as you can see in my original example, any
>> thresh>=0.03 prunes them. Do I missunderstand sthing (I'm not sure
>> what the "straight line" means here)?
>>
>> So we have 2 possibilities:
>>
>> 1. If in opposite to my interpretation of the source and manual,
>> angles/directions DO have something to do with the pruning thresh,
>> please somebody knowledgeable tell me what is that relation, so I
>> can fix the part of the manual, that reads "prune: remove vertices
>> in threshold from lines (...)".
>>
>> 2. If the pruning thresh doesn't depend on angles/directions, how
>> do I understand the fact that any thresh>=0.03 prunes points which
>> are at intervals of 10 on a straight line?
>>
>
> To plead in Markus' direction: there is a 3rd possibility:
>
> 3. Forget about the current pruning implementation and push the
> integration of another algorithm (Douglas-Peucker). (I know you are
> working on a script, but could this wait until this is done ?
I should have done that script by yesterday :D (no kidding, just laughing).
> Maybe if you push hard enough someone will "just do it" - Dylan
> mentioned it as a potentially "fun" project:
> http://grass.itc.it/pipermail/grassuser/2006-August/035529.html ;-)
> and actually links to an implementation in c++, which actually looks
> like more or less usable C to me).
Sure it would be a good addition to Grass, but:
1. I need a tool to remove the vertices from a line based on a given
threshold (understood as a distance from one vertex to another).
According to v.clean manual it should be able to do it, but it's not.
(I think I know how to workaround it by v.out.acii | awk | v.in.ascii.
So I should be OK.)
2. This is a bug or a lacking documention, so either should be fixed,
no matter what other pruning algorithm is added to Grass.
3. We can't remove any functionality in Grass 6, only add new.
> Markus you mentioned the source code on the GMT site. Could you be
> more precise on where to find it ?
Maciek
More information about the grass-dev
mailing list