[GRASSLIST:664] borehole database question

Dear grasslist

Suppose i do have a data base with two tables.

The first table with geographic information of boreholes: east,
west, and elevation coordinates an id and some other information
like quality and observations.

id | east | west | elev | quality

1 | xx1 | yy1 | zz1 | blah blah
2 | xx2 | yy2 | zz2 | blah blah

The second table is the log information of the boreholes. For each id
(each borehole) it has multiple records with, let’s say, stratigraphic
information: top level, base level a geological description, maybe some
rock type classification and so on.

id | cat | top | bottom | log

1 | 1 | z11 | z12 | rock
1 | 2 | z21 | z22 | another rock
1 | 3 | z31 | z32 | soil
2 | 4 | z41 | z42 | rock

The question is:

if i have loaded the borehole table into grass with v.in.db.
Which is the method to connect the log table with the borehole
vector, indeed how do i display the borehole data and query the
log table over a borehole point?

d.vect borehole
d.what.vect -t log ?


Patricio Toledo Peña
Dpto. de Geofísica - Universidad de Chile
Blanco Encalada 2002-Casilla 2777
Santiago-Chile

Hi Patricio,

AFAIK in order to link one vector file (e.g. location of boreholes) with an attribute table (e.g. lithology data) you need an unique identifier on both. Thus it is not possible to link the id of table 1 with the id of table 2 as id2 is not unique.
What I do to overcome this is to use the psql terminal to query the database.

HTH

Jaime

Patricio Antonio Toledo Peña patricioantoniotoledo@gmail.com escribió:

Dear grasslist

Suppose i do have a data base with two tables.

The first table with geographic information of boreholes: east,
west, and elevation coordinates an id and some other information
like quality and observations.

id | east | west | elev | quality

1 | xx1 | yy1 | zz1 | blah blah
2 | xx2 | yy2 | zz2 | blah blah

The second table is the log information of the boreholes. For each id
(each borehole) it has multiple records with, let’s say, stratigraphic
information: top level, base level a geological description, maybe some
rock type classification and so on.

id | cat | top | bottom | log

1 | 1 | z11 | z12 | rock
1 | 2 | z21 | z22 | another rock
1 | 3 | z31 | z32 | soil
2 | 4 | z41 | z42 | rock

The question is:

if i have loaded the borehole table into grass with v.in.db.
Which is the method to connect the log table with the borehole
vector, indeed how do i display the borehole data and query the
log table over a borehole point?

d.vect borehole
d.what.vect -t log ?


Patricio Toledo Peña
Dpto. de Geofísica - Universidad de Chile
Blanco Encalada 2002-Casilla 2777
Santiago-Chile


Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/

my only answer wuold be a script,

  • reading the answer of d.what.vect and set the point cat in a variable
    (ID=1)
  • run a query… echo “SELECT * from logtable where id=$ID” | db.select

but, how do i connect the logtable if it is on a external server?
do i have to import it? do i have to connect it? how do i connect it, if
it has no geographic atributtes? should i have to put all the information
on a single table?


Patricio Toledo Peña
Dpto. de Geofísica - Universidad de Chile
Blanco Encalada 2002-Casilla 2777
Santiago-Chile

no matter where the table reside....
just set appropriate parameters.... (db.connect)
and run your query (db.execute)...

Maxi

Patricio Antonio Toledo Peña wrote:

    my only answer wuold be a script,
    - reading the answer of d.what.vect and set the point cat in a
    variable
    (ID=1)
    - run a query..... echo "SELECT * from logtable where id=$ID" |
    db.select

but, how do i connect the logtable if it is on a external server?
do i have to import it? do i have to connect it? how do i connect it, if
it has no geographic atributtes? should i have to put all the information
on a single table?

--
Patricio Toledo Peña
Dpto. de Geofísica - Universidad de Chile
Blanco Encalada 2002-Casilla 2777
Santiago-Chile

--

Eng. Massimiliano Cannata
Scuola Universitaria Professionale della Svizzera Italiana
Istituto Scienze della Terra
Via Trevano, c.p. 72
CH-6952 Canobbio-Lugano
Tel: +41 (0)58 666 62 18
Fax +41 (0)58 666 62 09