[GRASSLIST:6728] Re: how to get other cats into other columns with v.to.db?!?!

Michael Barton michael.barton at asu.edu
Sat May 7 12:17:22 EDT 2005


Radim rewrote much of the vector code and continues to maintain this--an
enormous job. As one of the largest and most complex open source projects
out there, there is a huge amount of work needed to make GRASS work AND be
useable for others. But it requires volunteers to do it. That's why it's
free, in spite of being one of the best, and most comprensive spatial
technologies you can get--commercial or not.

If you've figured out how to use these aspects of v.to.db (and I HAVEN'T
been able to figure this out, though it's clearly a very powerful command),
PLEASE, PLEASE, PLEASE help with the documentation and with providing
examples. These can go into 2 places.

1. As you note, there needs to be better documentation for this command.
Radim, Markus, and a couple of others--as responsible programmers--provided
documentation for ALL GRASS program modules (there are some 400 of these and
many, like v.to.db, are complex). But the documentation could be much
improved, as all know. These are simple html files that most people could
help work on.

2. Markus and a couple of other people have started a GRASS 6 tutorial in
the GRASS WIKI site. Documentation and information could go there too.
Again, this is set up as a place that anyone can get an account for and
contribute to. 

As you point out, this is a very important role that GIS-savvy
non-programers can have that will make a very big difference to the GRASS
user community

Michael


On 5/5/05 6:03 PM, "Dan Jacobson" <jidanni at jidanni.org> wrote:

> Radim> You can upload a result of query in different layer using qlayer and
> Radim> qcolumn.
> 
> But the man page says: "'qlayer' is used for area category query",
> and I have lines, no?
> 
> And there are no query examples on the man page.
> 
> v.to.db map=i2 qlayer=2 qcolumn=contour option=query
> ERROR: This option requires one column
> v.to.db map=i2 qlayer=2 column=contour option=query
> ERROR: Database connection not defined for layer <2>. Use v.db.connect
>        first.
> v.db.connect map=i2 table=vcvc layer=2
> v.to.db map=i2 qlayer=2 column=contour option=query #qcolumn=contour
> Querying database ... DBMI-DBF driver error:
> SQL parser error in statement:
> SELECT (null) FROM vcvc WHERE cat = 28
> Error in db_open_select_cursor()
> 
> Who knows what you are talking about. Not me.
> Useless. Document it if not.
> All mumbo jumbo. Never mind. One can only do:
> $ v.category input=i2 option=print layer=1,2|perl -nwe \
> 'm/(\d+)\|(\d+)/;\
> printf "UPDATE vcvc SET contour=%d WHERE cat=%d;\n",\
> $2,$1'|db.execute
> 
> GRASS 6.0.0 (2005)
> 
> Wait. I figured it out, with no help from the non documentation.
> v.db.connect -o map=i2 table=vcvc layer=2
> v.to.db map=i2 qlayer=2 column=contour option=query qcolumn=cat
> 
> OK, but actually I want to put twice the value into the table,
> $ v.category input=i2 option=print layer=1,2|perl -nwe \
> 'm/(\d+)\|(\d+)/;\
> printf "UPDATE vcvc SET contour=%d WHERE cat=%d;\n",\
> $2*2,$1'|db.execute #Works, but let's try it the "smart" way:
> 
> $ ...
> ERROR: Error while executing: UPDATE vcvc SET contour=(contour + contour)
> ERROR: Error while executing: UPDATE vcvc SET contour=(contour * 2)
> 
> Anyways, you guys are in your own undocumented world.
> 
> ERROR: Error while executing: UPDATE vcvc SET contour=contour
> 
> Uh oh.
> 
> Wait,
> $ echo UPDATE vcvc SET contour=1|db.execute
> Works.  Great.  Wonderful.  Never mind.
> 
> What I am trying to say is "With meager documentation, nobody will
> understand how to use your programs." "Yes I could help write
> documentation, but, one problem: I don't understand how to use your
> programs."
> 
> And if you think
>        qcolumn=string
>               Query  column  used  for 'query' option. E.g. 'cat', 'count(*)',
>               'sum(val)'
> sounds like legal column names, well it doesn't to we unwashed folk.
> Obviously again some undocumented functionality only available to
> those "in the know" who have access to secret v.to.db examples.
> On the other hand, if even 2 + 2 produces an error, these probably
> don't work either.

____________________
C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ  85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>




More information about the grass-user mailing list