[GRASS-user] Vector map attributes

Craig Leat craig.leat at gmail.com
Mon Mar 30 10:10:49 EDT 2009


Hi

Thanks for the comments.

Moritz:
>>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 ?

Some points are exact duplicates (points were downloaded from the GPSr
more than once), others were captured in the field at different times
and although representing the same structure do not have identical
co-ordinates. I snap the points to try and achieve one point per
structure.

Markus M:
> ... maybe you get meaningful results if there is either
> one point with several categories or several points with one category each,
> but not both. I'm not sure what v.edit did, but it is possible that you now
> have several points with identical coordinates and all points have several,
> identical categories.

When I snap points A and B, a new feature C is created and it inherits
the attributes of B and C, even if they are identical. Since I'm
counting rows of attributes (not features) these extra categories
cause problems and need to be removed. v.clean and v.edit don't help
because they remove features not cats.

Moritz:
> Or v.clean tool=rmdupl (although the man page says "pay attention to
> categories!" - don't know what that means).

Cats are not deleted when a feature is removed (at least for the
rmdupl tool). Could be clarified in the manual, I think.

My solution:
1. Use v.category opt=print and parse out one cat per feature
2. Add a new table (MyCats) to the point vector and populate it with
the list of cats.
3. Instead of:
echo "SELECT *,count(Area) FROM MT_San_clean GROUP BY Area" | db.select
cat|Area|Ref|Lat|Lon|Altitude|Y|X|count(Area)
2177|Gcina|695|-29.6|30.588|729|-39940.752|-3275795.484|2177
3325|Inhlazuka|1237|-30.056|30.439|0|-54111.923|-3326403.99|1148

do this instead (thanks Moritz):
echo "SELECT *,count(Area) FROM MT_San_clean WHERE ""cat in (select *
from MyCats)"" GROUP BY Area" | db.select
cat|Area|Ref|Lat|Lon|Altitude|Y|X|count(Area)
2170|Gcina|688|-29.596|30.589|763.4|-39861.292|-3275438.023|1340
3325|Inhlazuka|1237|-30.056|30.439|0|-54111.923|-3326403.99|616

Gcina down from 2177 to 1340. Wow, fieldwork was really bad!

I'll try to update the FAQ...

Craig


More information about the grass-user mailing list