[GRASS-user] Deleting vertices based on a list of points

Moritz Lennert mlennert at club.worldonline.be
Thu Jun 4 04:13:29 EDT 2009


On 03/06/09 19:17, Dwight Needels wrote:
> On Jun 3, 2009, at 4:50 AM, Moritz Lennert wrote:
> 
>> On 02/06/09 20:50, Dwight Needels wrote:
>>> Hi all,
>>> I have two vectors: Vector A has lines and Vector B has points that 
>>> share the same coordinates as a subset of the vertices in the lines. 
>>> I would like to delete all of the vertices/nodes in Vector A that lie 
>>> directly underneath the points in Vector B (or perhaps lie within a 
>>> threshold).
>>> I suspect that v.edit tool=vertexdel can do this, but I cannot figure 
>>> out how to pass the coordinates of a set of points from Vector B to 
>>> v.edit to be used to select vertices in Vector A for deletion. Could 
>>> somebody give me a hand with this (or tell me it is not possible)?
>>
>>
>> Feed the output of v.to.db -p option=coor on Vector B into the coords= 
>> parameter of v.edit on Vector A, i.e. something like this:
>>
>> v.edit A tool=vertexdel coords=`v.to.db -p B option=coor --quiet | awk 
>> -F";" '{printf"%f,%f,",$2,$3} END{printf"\n"}'`
>>
>> Moritz
>>
> Thanks! This worked great with two small changes... using "|" instead of 
> ";" 

yes, obviously... I'm so used to ";" that my fingers type it 
automatically ;-)

> for the field terminator and specifying layer=2 because the points 
> were generated by v.to.points, which puts the point data on layer 2.

You also should not need the END{printf"\n"} which was a leftover from 
quick command line tests, but only needed to get me the prompt on a new 
line...

Moritz

> -Dwight
> 



More information about the grass-user mailing list