<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-3" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dear Moritz: that's a lot of options -- thanks!!!<br>
<br>
Moritz Lennert wrote:
<blockquote cite="mid:47F10146.8070704@club.worldonline.be" type="cite">On
31/03/08 16:04, Luigi Ponti wrote:
<br>
<blockquote type="cite">Dear list,
<br>
<br>
I am trying to import the European Vector Database (ESDB) version 2 to
GRASS <br>
[...]<br>
Is it possible to connect those .dbf files to the imported GRASS vector
based on an attribute column (not the 'cat' column) that is present
both in layer 1 of the vector and in those additional (not connected)
.dbf files?</blockquote>
<br>
Several options:
<br>
<br>
1) Use a real database backend (sqlite, postgresql), import the other
dbf files with db.in.ogr, then either
<br>
a) link to the map attribute table with v.db.join
<br>
b) create a view combining the cat column from the map attribute
with the other table and use v.db.connect to link to that table
<br>
</blockquote>
I suspected that joins and views were the way to go, because I had been
reading philosophical threads some time ago about whether or not grass
was supposed to support those. However, I am not a database expert, so
thanks for indicating this path that may be a good primer to get more
into real database backends for GRASS.<br>
<blockquote cite="mid:47F10146.8070704@club.worldonline.be" type="cite"><br>
2) If the columns linking your map to the other tables are integer, you
can also do
<br>
- v.reclasse with 'column' option
<br>
- v.db.connect the result of the reclass to the relevant dbf table
<br>
</blockquote>
Yes, the link columns are integers, luckily. I tried this -- easy and
elegant. It works fine with DBF. Does the GRASS DBF engine has a size
limitation for some operations? I got an error while trying the
following:<br>
<blockquote>GRASS 6.2.2 (SoilEurope2):~ >d.vect -c sgdbe4_0_reclass
display=attr attrcol=EAWC_TOP<br>
DBMI-DBF driver error:<br>
SQL parser error in statement:<br>
select EAWC_TOP from smu_ptrdb.dbf where cat = 330677<br>
Error in db_open_select_cursor()<br>
<br>
ERROR: Cannot select attributes:<br>
select EAWC_TOP from smu_ptrdb.dbf where cat = 330677<br>
</blockquote>
Note that cat=330677 is 2572th row of the .dbf table (if I change
attribute column, I always get an error on the same cat).
<blockquote></blockquote>
<blockquote cite="mid:47F10146.8070704@club.worldonline.be" type="cite"><br>
3 More complicated:
<br>
- in your existing map create a new layer of cats with e.g.
v.category map=sgdbe4_0 option=add layer=2
<br>
- find the correspondance of the newly created cats with the cats
in layer 1 with v.build sgbde4_0 option=cdump
<br>
- use that information to create a new table which contains the
layer 2 cat and the key column needed to link to the other dbf tables
<br>
- then proceed as in 1)
<br>
</blockquote>
This one is a bit out of my range: I need to do some homework. Of the
three options, this was the hardest for me to understand.<br>
<blockquote cite="mid:47F10146.8070704@club.worldonline.be" type="cite"><br>
<br>
We really could do with an enhancement to v.category to allow the
creation of a second layer of categories based on a column value of the
attributes linked to the first...
<br>
<br>
Moritz
<br>
<br>
</blockquote>
Thanks again for a great GRASS-database seminar.<br>
<br>
Kind regards,<br>
<br>
Luigi<br>
<br>
</body>
</html>