[GRASS-user] RE: Problem querying layers other than '1' in gi s.m

Patton, Eric epatton at nrcan.gc.ca
Wed Sep 20 14:20:10 EDT 2006


Yes, thanks, makes sense Dylan. I'll need some time to experiment before I
report back on success/failure.

Cheers,

~ Eric. 

-----Original Message-----
From: Dylan Beaudette
To: grassuser at grass.itc.it
Cc: Patton, Eric; 'Moritz Lennert '
Sent: 9/20/2006 1:35 PM
Subject: Re: [GRASS-user] RE: Problem querying layers other than '1' in gi
s.m

On Wednesday 20 September 2006 06:44, Patton, Eric wrote:
> Moritz:
> >You do not have to duplicate the points, but IIUC you have to assign
a
> >category value for each point in each layer. (See
>
>http://mpa.itc.it/markus/grass63progman/Vector_Library.html#vlib_catego
r
> >ies_layers)
>
> I'm probably misunderstanding the use of layers in general, but I
thought
> it was analogous to 'joined tables' in Arc (one geometry, many
tables).
>
> Thinking about how I linked the tables to the vector, I just realized
how I
> may have made a mistake. The vector in question is a series of points
> representing sample locations. Layer one contains a table with cat,
> Timestamp, Easting and Northing. I wanted to create a second layer
linking
> to a table containing biological analyses of the sample data. The only
> column in common between layer one and layer two is the timestamp
field. Do
> I also need a field in layer 2 telling what cat in layer 1 it belongs
to?
> Maybe that is why I can't query anything from layer 2. If I am right
here,
> how can I construct an SQL statement to populate layer 2 with the
> corresponding cat from layer 1 where the timestamps in each table
match?
>
> >BTW: have you tried to query on the command line (using d.mon x0 to
open
> >a monitor) ?
> >
> >Moritz
>
> Yes, I tried the same thing using d.what.vect -e and only layer one's
> attributes are queried.
>
> ~ Eric.
>

Eric, the way that i usually approach this type of problem in GRASS is
as 
follows:

1. store my attribute data in a RDBMS such as mysql, postgresql, sqlite,
etc.
2. create some vector data with at least two columns: 'cat' and 'id'
'cat' is used by v.db.connect to associate a row with a vector feature
'id' is used to associate other attribute data with a row

3. create a new, composite  table (from two existing tables 'vector' 
and 'data') with something like:
create table new_table as 
select vector.cat, vector.id, data.time, data.temp
from vector, data
where vector.id = data.id ;

4. then hookup new_table to the original vector file with v.db.connect

make sense? 


-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list