[GRASS5] attributes using v.overlay

Dear list,

I used the module v.overlay with operator "or" -> union, but I guess it`s the same for all operators. I have following problems with the attributes.

### Example:
v.overlay ainput=area1 binput=area2 output=area3 operator=or

the attribute table for area3 looks like this:

cat | cata | catb
1 | 2 | 4
2 | 4 | 7
...

AFAICS these columns can be connected to the attribute tables from ainput and binput using different fields.

It seems that this is not done automatically, because in file
vectors/area3/dbln only one link to column "cat" is set

-> 1 area3 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf

anyway now I can add further links to the other attribute tables via fields manually or by using v.db.connect

-> 2 area1 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
-> 3 area2 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf

When I now query the map I get all attributes from the two maps I overlayed (unioned) before - this is nice and the result I was expecting.
#######

Now my questions:

a) Why are the two attribute tables of the input maps area1 and area2 not automatically linked in vectors/area3/dbln?

b) How is it possible to query two attributes represented by different fields? E.g. show all areas where area1 connected through field 2 has value 1 and area2 connected through field 3 has value 2.

c) When I remove the overlayed map area3, also the basemaps area1 and area2 are deleted, which is really bad :-(. How can I prevent this without removing the "dbln" entries?

thanks a lot
  otto

On Monday 06 September 2004 17:13, Otto Dassau wrote:

Dear list,

I used the module v.overlay with operator "or" -> union, but I guess it`s
the same for all operators. I have following problems with the attributes.

### Example:
v.overlay ainput=area1 binput=area2 output=area3 operator=or

the attribute table for area3 looks like this:

cat | cata | catb
1 | 2 | 4
2 | 4 | 7
...

AFAICS these columns can be connected to the attribute tables from ainput
and binput using different fields.

It seems that this is not done automatically, because in file
vectors/area3/dbln only one link to column "cat" is set

-> 1 area3 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf

anyway now I can add further links to the other attribute tables via fields
manually or by using v.db.connect

-> 2 area1 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
-> 3 area2 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf

When I now query the map I get all attributes from the two maps I overlayed
(unioned) before - this is nice and the result I was expecting. #######

Now my questions:

a) Why are the two attribute tables of the input maps area1 and area2 not
automatically linked in vectors/area3/dbln?

The tables area1 and area2 are parts of of other vectors. It would be necessary
to make a copy of those tables. My intention however is to create a new table
linked to the field 1 which will contain attributes from both tables.

b) How is it possible to query two attributes represented by different
fields? E.g. show all areas where area1 connected through field 2 has value
1 and area2 connected through field 3 has value 2.

You have to join the tables somehow (area1,area2,area3) or to use v.extract
twice.

c) When I remove the overlayed map area3, also the basemaps area1 and area2
are deleted, which is really bad :-(. How can I prevent this without
removing the "dbln" entries?

The input maps?! No, just the tables. v.db.connect prints a warning.
The table linked to a vector is part of the vector. The only thing
we can do to prevent this, is to remove v.db.connect, I think.

Radim

On Mon, 6 Sep 2004 18:13:24 +0200
Radim Blazek <blazek@itc.it> wrote:

On Monday 06 September 2004 17:13, Otto Dassau wrote:
> Dear list,
>
> I used the module v.overlay with operator "or" -> union, but I guess it`s
> the same for all operators. I have following problems with the attributes.
>
> ### Example:
> v.overlay ainput=area1 binput=area2 output=area3 operator=or
>
> the attribute table for area3 looks like this:
>
> cat | cata | catb
> 1 | 2 | 4
> 2 | 4 | 7
> ...
>
> AFAICS these columns can be connected to the attribute tables from ainput
> and binput using different fields.
>
> It seems that this is not done automatically, because in file
> vectors/area3/dbln only one link to column "cat" is set
>
> -> 1 area3 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
>
> anyway now I can add further links to the other attribute tables via fields
> manually or by using v.db.connect
>
> -> 2 area1 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
> -> 3 area2 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
>
> When I now query the map I get all attributes from the two maps I overlayed
> (unioned) before - this is nice and the result I was expecting. #######
>
> Now my questions:
>
> a) Why are the two attribute tables of the input maps area1 and area2 not
> automatically linked in vectors/area3/dbln?

The tables area1 and area2 are parts of of other vectors. It would be necessary
to make a copy of those tables. My intention however is to create a new table
linked to the field 1 which will contain attributes from both tables.

Yes, that would be my intention, too.

> b) How is it possible to query two attributes represented by different
> fields? E.g. show all areas where area1 connected through field 2 has value
> 1 and area2 connected through field 3 has value 2.

You have to join the tables somehow (area1,area2,area3) or to use v.extract
twice.

ok, and would be solved by a)

> c) When I remove the overlayed map area3, also the basemaps area1 and area2
> are deleted, which is really bad :-(. How can I prevent this without
> removing the "dbln" entries?

The input maps?! No, just the tables. v.db.connect prints a warning.

No, "only" the tables, of course. and yes, v.db.connect prints a warning.

The table linked to a vector is part of the vector. The only thing
we can do to prevent this, is to remove v.db.connect, I think.

No, that wouldn't make sense. I think all this would be solved with the idea you mentioned in a) to create a new table
linked to the field 1 which will contain attributes from both tables.

For now it is just important to know, that automatic joining of tables is not implemented yet and that it might be dangerous to connect further tables manually or with v.db.connect to a vectormap created with v.overlay.

If you agree, I will add a note to the description file and send you a diff for the manual page.

  thanks
   Otto