[GRASS-user] Vector map attributes
craig.leat at gmail.com
Wed Mar 25 06:05:13 EDT 2009
I have a vector map with points representing latrines and each point
has an attribute describing the place name. I ran v.edit to snap
points with a threshold of 5m and v.info reports 7296 features for the
cleaned map. I now wish to count the number of latrines in each place,
so I ran:
> echo "SELECT *,count(Area) FROM MT_San_clean GROUP BY Area" | db.select
and get a total of 10537, so the results are bogus.
Running the following command I can see the reason for the bogus results:
> v.category in=MT_San_clean opt=print
v.edit has assigned multiple categories to points when they were snapped.
To get a meaningful count of points by Area I can think of two solutions:
1) Use awk to filter out the first category for each feature from the
output of v.category opt=print and feed this list of cats into
however I'm not sure of the sql syntax for WHERE "cat=MyListOfCats".
2) Use awk to filter out all, but the first category for each feature
from the output of v.category opt=print and feed this list of cats
into v.category opt=del,
however I'm not sure of the relationship between feature ids and cats,
and v.category wants a list of ids.
Can someone please suggest an easier way or give me a pointer to
implement either of my ideas? As a teaser I can offer to update 
with the details :-)
More information about the grass-user