<div dir="ltr"><div><div><div>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).<br><br></div>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.<br><br></div>Next, I want to use this to count the number of categories linked to each unique feature id.<br><br></div>I know this has been asked and answered before, but the solutions (copied below) do not work for me.<br><div><br>This worked, I think, in GRASS 6, but it doesn't in G7 because a new vector map needs to be defined<br>
><i> v.category op=add layer=2 type=centroid</i><br>
><i> v.to.db type=centroid option=cat</i><br>
<br>The below does not create an attribute table with unique attributes for each unique feature.<br>
<i>> v.in.ogr dsn=test_polygones.shp out=polygons<br>

> v.db.addtable polygons layer=2<br>

> v.category polygons option=add layer=2 type=centroid out=polygons_tmp<br>
> v.to.db polygons_tmp type=centroid option=cat layer=2 col=cat</i><br>
</div></div>