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

Thomas Adams Thomas.Adams at noaa.gov
Fri Mar 17 15:45:19 EST 2006


Markus,

Great! Thank you very much (now I know I'm not insane, well... as it 
relates to this topic anyhow). This is the conclusion I had come to, 
that is, that I needed to change the Postgres table. My problem is that 
the Postgres table schema is not under my control, so I'll have to 
create a new one.

You asked about:

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


Pretty funny actually, in the 'wisdom' of the database designers, they 
assumed the longitude would always be in the Western Hemisphere at least 
for the *application* of the database values. So, negative longitude 
values can not be used. The "x=-1*lon", as it turns out, actually will 
convert the positive longitude values to negative in the SQL query -- it 
works.

Cheers!
Tom


Markus Neteler wrote:
> 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
>
>   


-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:	thomas.adams at noaa.gov

VOICE:	937-383-0528
FAX:	937-383-0033




More information about the grass-user mailing list