[GRASSLIST:2714] Re: Upload sites to db

Radim Blazek radim.blazek at dhv.cz
Sat Dec 1 14:44:40 EST 2001


On Thu 29. November 2001 07:42, Harald Wehr wrote:
> Hi grasslist,
>
> to upload a vector to a database I can use "v.to.db". But I didn' t find
> any hints on how many columns the table must have and which _datatypes_
> a column therefore should have.
>
> Can you give any hints?
>
> Thanks
> Harald

The table should have at least id/key (integer) and x, y (numbers).

Example:
db.connect driver=odbc database=sites
 
echo "create table sites (id int4, x float8, y float8, type char(1),  \
         name varchar(50))"  | db.execute
# postgresql specific types used here

v.to.db type=site map=sites option=cat table=sites key=id
v.to.db type=site map=sites option=coor table=sites key=id col1=x col2=y

d.db table=sites x=x y=y
d.what.db table=sites key=id x=x y=y

Unfortunately I have found bugs in d.what.db (db.attr), both fixed now
in repository, but you need to update:
src/libes/dbmi/clients/
src/display/d.what.db/

Radim



More information about the grass-user mailing list