[GRASS-user] Question about layers and categories

Markus Metz markus.metz.giswork at gmail.com
Thu Apr 4 11:23:43 PDT 2013

On Thu, Apr 4, 2013 at 6:24 PM, Vincent Bain <bain at toraval.fr> wrote:
> Hi,
> I hope the questions to come are not too stupid, but I need some help
> about some points that remain to me unclear about vector layers &
> category management :
> Let's take the case of a point vector produced by v.to.point module. You
> know this command creates a 2 layers vector, consisting in:
> - 2 distinct tables,
> - 2 sets of categories.
> The first point is when removing a layer, categories associated with
> this layer /remain/ attached to the geometry.

How did you remove a layer? If you used v.db.connect -d or
v.db.droptable, then you deleted the link of an attribute table to a
layer. As you observed, categories for this layer will remain attached
to the geometry as reported by v.category op=report.

> Should I purge categories
> from the layer I want to delete (with v.category command) prior to
> remove layer ?

Do you want to remove the attribute table or the categories attached
to the geometry objects?

Usually it does not harm to have categories attached to geometries in
multiple layers.
> When I remove layer 1, trying to query layer 2 points in wxGUI display
> window, the result appears in the terminal but the classical pop-up does
> not rise (whatever "layer" parameter in d.vect).

The wxGUI query ignores d.vect options and will (should) report
anything found in any layer.

> Then I try to change layer "2" to number "1" (v.category with
> option=chlayer layer=2,1). The command performs without apparent
> problem, but v.to.db -p tells me the expected layer 1 is still number
> 2...

Can you post the output of v.to.db -p? I did a quick test and v.to.db
does not tell me anything about an expected layer number...

> In a word, all this is very confusing.
> Could anyone help me to point at what is going wrong, either in my
> understanding of attribute handling  or in possible issues in the
> commands I use (v.to.db, v.category)

In short, categories and associated layer numbers are stored with the
geometry. Category numbers for a given layer are used as key for the
link to an attribute table for the given layer. IOW, you need a vector
geometry object with a category number for a given layer and that
category number existing in the key column of the corresponding
attribute table in order to have attributes linked to the given object
and layer.


Markus M
> Thanks,
> Vincent
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

More information about the grass-user mailing list