[GRASS-dev] Extracting a subset from a set of (vector) points

Damiano Triglione damiano.triglione at polimi.it
Thu Jan 25 11:11:54 EST 2007


Hi,
I need to extract, from a vector points file, a subset of points, according 
to the IDs listed (after a sort) in another ASCII files, "indexes".
I thought it was a good idea to create a proper ASCII file containing
ID east north
of the entire data set (using v.out.ascii, awk and sort) and then use the 
coreutils "join" to find the matches.
Unfortunately, join works in a weird ways when the join field is numerically 
and the numbers, even if sorted (!), have different lengths.
What I mean is this:
if all the IDs have the same length (example: 2 digits), then join works 
perfectly; while if I have the following indexes list:
1
2
8
10
12
then join passes to analyze 10 and 12 only after having analyzed 8!
I tried a different sorting, for example
1
10
12
2
8
and so things improve, but still some mistakes are obtained.
How can I fulfill my purpose?
Maybe I could use an SQL query, if Grass DBF driver support the clause "IN", 
meaning
select * from dataset where "cat IN {1,2,8,10,12}"               ??
Thanks for your help,
Damiano 




More information about the grass-dev mailing list