Dear Moritz: that's a lot of options -- thanks!!!
Moritz Lennert wrote:
On 31/03/08 16:04, Luigi Ponti wrote:
Dear list,
I am trying to import the European Vector Database (ESDB) version 2
to GRASS
[...]
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?
Several options:
1) Use a real database backend (sqlite, postgresql), import the other
dbf files with db.in.ogr, then either
a) link to the map attribute table with v.db.join
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
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.
2) If the columns linking your map to the other tables are integer,
you can also do
- v.reclasse with 'column' option
- v.db.connect the result of the reclass to the relevant dbf table
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:
GRASS 6.2.2 (SoilEurope2):~ >d.vect -c sgdbe4_0_reclass display=attr
attrcol=EAWC_TOP
DBMI-DBF driver error:
SQL parser error in statement:
select EAWC_TOP from smu_ptrdb.dbf where cat = 330677
Error in db_open_select_cursor()
ERROR: Cannot select attributes:
select EAWC_TOP from smu_ptrdb.dbf where cat = 330677
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).
3 More complicated:
- in your existing map create a new layer of cats with e.g.
v.category map=sgdbe4_0 option=add layer=2
- find the correspondance of the newly created cats with the cats
in layer 1 with v.build sgbde4_0 option=cdump
- 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
- then proceed as in 1)
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.
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...
Moritz
Thanks again for a great GRASS-database seminar.
Kind regards,
Luigi
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user