[GRASS-user] Simple example about vector database layers in GRASS

Moritz Lennert mlennert at club.worldonline.be
Tue Jun 14 08:50:55 PDT 2016


On 14/06/16 09:45, roy roy wrote:
> I'm reading this wiki page:
>
> https://grasswiki.osgeo.org/wiki/Vector_Database_Management#The_concept_of_layers
>
> about the GRASS vector model ad the sketch seems to suggest that I can
> setup and display
> several layer given an available or digitized vetor geometry
>
> In the example I have a vector object (centroid)
>
> id = 16 ( a centroid )
> (this id is automatically assigned an internal feature id ... can the id
> be diplayed?
> how do I know a geometry id?)
>
> joined with two distinct attribute tables via category values, i.e.
>
> 16 -> 31  (wheat)
> 16 -> 26  (a name)
>
> then there is a boundary with id 1:
>
> 1 ->  5 (connected to category 5)
>
> what it seems not clear is how you set up such connections:
>
> How do i know what id is assigned to a geometry?
>
> How do i connect "category" to "id" so that I can assign an owner to
> each area ?

id's are only used internally. You should only worry about categories. 
These can either be used as id's (thus you would connect attribute data 
to features by indicating the category value in the key column of your 
attribute table), or you can use category values as attributes by 
themselves (e.g. your example with 31 meaning wheat). The former usage 
is the classical vector feature <-> attribute table row paradigm. The 
latter allows to integrate attributes directly into the vector file, 
thus making some operations faster by completely bypassing the need for 
attribute database table handling.


>
> what does the following phrase from the page means?
> "code" value 34 within table "plots" has no corresponding category in
> layer 2;
> is the term "category" used instead of "id" (quite confusing ...)

Yes.

>
> is there a list of modules to perform this operation that could help to
> better understand?

You use v.category to add / delete / modify category values of features. 
Category values are also added automatically by most vector import modules.

If you want to add an attribute table using these category features (if 
no attribute table exists, yet), you can use v.db.addtable. By default 
this will create an attribute table with only one (key) column 'cat', 
containing all the category values existing in the chosen layer.

Layers can be seen as information layers. In each information layer you 
can attribute zero, one or more category values to each feature, and to 
each information layer you can attach one attribute table.

I hope this makes it a bit clearer.

Moritz




More information about the grass-user mailing list