[GRASS-user] simple way to join some attribute data w/o geometries

Moritz Lennert mlennert at club.worldonline.be
Mon Jan 7 09:14:50 EST 2008


On 07/01/08 14:36, Benjamin Ducke wrote:
> That was my first guess, too.
> However, v.db.join does not support the DBF backend, according
> to the manual page.

Looking at it quickly, I think that it should be possible to make 
v.db.join support dbf if you use the v.db.update. Something like this:

very roughly (supposing there is no header line):

NumberofFields=`awk -F',' '{print NF}' brol.text`

names[]=get column names in first line

[some way of determining column types]

for i in (1-NumberOfNewColumns):
     v.db.addcol mymap col='$names[i] $type[i]

for all lines in csv file (except first):
    for (i=1; i<=NumberOfNewColumns;i++):
       v.db.update mygeodetic_pts col=col$i value=`cut -d',' -f$i 
brol.text` \
         where=cat=`cut -d',' -f1 brol.text`

where brol.text contains
14429,2,3,4

This could probably be done more elegantly, but in any case it should be 
possible.

Moritz


More information about the grass-user mailing list