[GRASS-user] Problems in adding tables to a map

GRASS user,

I’m having some problem in connecting tables to a map.

This is the procedure (in order to simplify I used the same table but with different names) :

g.copy vect=roads,roads1

g.copy vect=roads,roads2

The two tables are in the table list.

db.tables -p

v.db.connect map=roads1 table=roads2 layer=2

The connections seem ok:

v.db.connect -p map=roads1

Vector map roads1@esercizi is connected by:

layer <1> table in database </home/clerici/GRASSdata/spearfish60/esercizi/dbf/> through driver with key

layer <2> table in database </home/clerici/GRASSdata/spearfish60/esercizi/dbf/> through driver with key

But:

d.mon x0

This displays the map with lines and labels

d.vect map=roads1 disp=shape,attr attrcol=label layer=1

This doesn’t produce any output

d.erase

d.vect map=roads1 disp=shape,attr attrcol=label layer=2

I tried a check by producing the ASCII file with:

v.out.ascii in=roads1 form=standard

but after each sequence of coordinates only layer 1 is reported

L 6 1

590744.10526028 4926835.64296535

590742.5374415 4926835.30309294

590624.60065406 4926810.04019906

590503.0158192 4926784.15943798

590383.85077876 4926762.55284068

590253.15645239 4926731.77335036

1 4

L 2 1

591497.07137115 4926772.322352

591667.99469283 4926778.18725746

1 4

Another check with:

v.extract in=roads1 out=roads_extr layer=2 list=1-3

produces an empty map.

Did I miss something in the connection command?

Thanks

Aldo Clerici

On 17/11/12 11:42, Aldo Clerici wrote:

GRASS user,

I'm having some problem in connecting tables to a map.

This is the procedure (in order to simplify I used the same table but
with different names) :

g.copy vect=roads,roads1

g.copy vect=roads,roads2

The two tables are in the table list.

db.tables -p

v.db.connect map=roads1 table=roads2 layer=2

The connections seem ok:

v.db.connect -p map=roads1

Vector map <roads1@esercizi> is connected by:

layer <1> table <roads1> in database
</home/clerici/GRASSdata/spearfish60/esercizi/dbf/> through driver <dbf>
with key <cat>

layer <2> table <roads2> in database
</home/clerici/GRASSdata/spearfish60/esercizi/dbf/> through driver <dbf>
with key <cat>

Contrary to common belief (and unfortunately some parameter descriptions in man pages still support that belief) layers are not connections to tables as such. You can, however, connect features that have category values in a given layer to a table. Please read the section on layers in the introduction to vector data processing in the man pages [1].

In your case, no feature has a category value in layer 2 so layer 2 is "empty" in terms of vector features. You first have to add category values to layer 2 in the vector file in order to be able to visualise them and to connect them to attributes in a table.

Moritz

[1] http://grass.fbk.eu/grass64/manuals/html64_user/vectorintro.html