[GRASS-user] Vector map attributes
mlennert at club.worldonline.be
Wed Mar 25 12:22:53 EDT 2009
On 25/03/09 11:05, Craig Leat wrote:
> 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
Because you think that these points are actually duplicates, or because
you want the information about all latrines within a certain radius to
be regrouped ?
> 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".
Create a table MyCats containing your cats and the use WHERE "cat in
(select * from MyCats)"
> 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.
use v.edit select= cats= to find out ids.
> Can someone please suggest an easier way or give me a pointer to
> implement either of my ideas?
How about v.edit catdel= cats= ?
Or v.clean tool=rmdupl (although the man page says "pay attention to
categories!" - don't know what that means).
More information about the grass-user