[GRASS-user] get vector table with unique feature id

Paulo van Breugel p.vanbreugel at gmail.com
Fri Apr 3 05:42:02 PDT 2015


I have a shapefile with overlapping polygons. After importing I thus end up
with a vector layer with for each unique polygon (feature) one or more
category values (i.e., one to many relationship).

Now I want to create a second attribute table linked to layer 2 with a cat
column with for each polygon (for each internal feature id) an unique
category.

Next, I want to use this to count the number of categories linked to each
unique feature id.

I know this has been asked and answered before, but the solutions (copied
below) do not work for me.

This worked, I think, in GRASS 6, but it doesn't in G7 because a new vector
map needs to be defined
>* v.category op=add layer=2 type=centroid*
>* v.to.db type=centroid option=cat*

The below does not create an attribute table with unique attributes for
each unique feature.



*> v.in.ogr dsn=test_polygones.shp out=polygons > v.db.addtable polygons
layer=2 > v.category polygons option=add layer=2 type=centroid
out=polygons_tmp > v.to.db polygons_tmp type=centroid option=cat layer=2
col=cat*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150403/2c16287e/attachment.html>


More information about the grass-user mailing list