[GRASSLIST:225] Re: [GRASS5] Built-in vector documentation extended

Markus Neteler neteler at itc.it
Fri Mar 17 15:08:50 EST 2006


Thomas,

On Fri, Mar 17, 2006 at 02:55:52PM -0500, Thomas Adams wrote:
> Michael,
> 
> Your instructions did not help... I'm sorry to be a bother about this, 
> so, I'll restate the problem I'm having.
> 
> I have a Postgres database with a table called 'location', which 
> consists of meteorological observation points with lat-long coordinates 
> along with various other attributes:
> 
> CHARACTER|lid
> CHARACTER|county
> CHARACTER|coe
> CHARACTER|cpm
> CHARACTER|detail
> DOUBLE PRECISION|elev
> CHARACTER|hdatum
> CHARACTER|hsa
> CHARACTER|hu
> DOUBLE PRECISION|lat
> DOUBLE PRECISION|lon
> CHARACTER|lremark
> DATE|lrevise
> CHARACTER|name
> CHARACTER|network
> CHARACTER|rb
> CHARACTER|rfc
> DATE|sbd
> CHARACTER|sn
> CHARACTER|state
> CHARACTER|waro
> CHARACTER|wfo
> CHARACTER|wsfo
> CHARACTER|type
> CHARACTER|des
> CHARACTER|det
> INTEGER|post
> CHARACTER|stntype
> CHARACTER|tzone
> 
> Please notice that only one field is type integer, namely, the 'post' 
> field; it is a boolean (1 or 0).

... so 'post' is unsuitable. key must be an unique ID column.

> 
> When I use the GRASS v.in.db command:
> 
> v.in.db driver=pg database=host=dell3-tir,dbname=hd_ob6tir 
> table=location x=-1*lon y=lat z=elev key=1 where=rfc='OHRFC' 
> output=locations

Funny, that v.in.db accepts this input:

database=host=dell3-tir,dbname=hd_ob6tir
-> database="host=dell3-tir,dbname=hd_ob6tir"

x=-1*lon
-> x=lon (what does -1*lon mean? The command wants a column *name*)

key=1
-> key=columname (apparently you don't have a column with unique
                  ID, so you will have to add one with 
                  ALTER TABLE ..., see db.execute)

> I am forced to supply key=???; the only thing that works for me is key=0 
> or key=1, etc. since I have no integer field with unique integer values. 

If you don't have it, you will have to modify the table.
There is no other way IMHO.

All which is done here it telling v.in.db how the columns are named.
Any calculation must be done beforehand in the table, using SQL
or other ways (depends on the data storage).

Apparently the manual page of v.in.db is unclear, I would appreciate
suggestions how to improve it.

Markus




More information about the grass-user mailing list