[GRASS-user] Connect additional table based on layer 1 attribute column

Dwight Needels needels at translucida.com
Sun Jun 29 16:26:43 EDT 2008

Hi all,

I have what I thought might be a use for multiple layers in GRASS, but I
haven't been able to figure out how to test it (I am relatively new to
GRASS). I am using William Kyngesburye¹s 6.3cvs on Mac OS 10.4.11 with a
SQLite database backend.

I have a parcels vector file (myParcels) with ~16,000 real estate properties
with associated attribute data. I used v.db.update to populate a new integer
data column named OwnerCat with an ID for one of nine categories of
ownership (city parks, vacant parcels, schools, etc.). I created a second
table (Parcel_Ownership) with nine records and three fields: cat2,
OwnerCategory (a text description), and GRASSRGB.

I wanted to connect the Parcel_Ownership table to layer 2 using
OwnerCat/cat2. My idea was to use layer 1 for queries, but use layer 2 for
coloring and generating a legend.

Is it possible to use GRASSRGB and description columns from layer 2 for
coloring/legend while displaying (and querying) layer 1 data?

This topic is similar to a previous thread:

The potential enhancement to v.category described at the end seems to be the
feature I have been looking for in order to test my idea of associating the
two related tables with two layers. Is there a different way to do this?

Moritz also describes several workarounds that don't involve multiple
layers. Using these suggestions I have found two alternate ways to
accomplish my goal; 1) pull all of the data into layer 1 of a single vector
map and 2) use two copies of the vector geometry with one linked to parcel
attributes and the other linked to owner category data. However, neither of
these approaches make it easy to change things such as the color or text
description associated with an owner category.

Option 1a (using v.db.join). An update to color or owner category
description requires running the join again, which is complicated by the
lack of an overwrite flag (the second join fails with a duplicate column
name error).

Option 1b (creating a view and connecting to it). Is it possible to create a
view within GRASS or using SQLite Database Browser (or other free Mac OS

Option 2 (using v.reclass and v.db.connect). An update to color or owner
category description requires running the reclass and connect again. It also
involves maintaining two identical copies of the vector geometry. It seems
that this would be avoided if v.reclass would write the reclassed map to
layer 2 of the input map (instead, even with --o it fails with a output
vector map is used as input error). Would this be equivalent to the
mentioned v.category enhancement?

Option 3 (using v.category). I'm not exactly sure what this should
accomplish. I cannot add a second layer to the existing vector map (output
vector map is used as input error), and the newly created cats appear to be
identical to the original ones. Am I missing something here?

Is there (or could there be) a way within GRASS to associate two (or more)
related tables with a vector map with a "live" connection that would
automatically update when changes are made to one of the related tables?

Barring that, can v.category, v.db.join and v.reclass behavior be modified
as described?



More information about the grass-user mailing list