[GRASS-user] split 'multi-polygons' in grass, how to?

Moritz Lennert mlennert at club.worldonline.be
Wed Aug 28 05:41:55 PDT 2013

On 12/08/13 13:29, Martin Koch wrote:
> Dear grass mailing list readers,
> I'm scripting a big project with vector data in grass using Python and
> the GRASS Python scripting library.
> At some point I use 'dissolve' to remove a whole lot of boundaries.
> In the resulting map not all centroids have identical cats.

I imagine this is supposed to say: "not all centroids have unique cats" ?

> They
> represent areas with identical attributes, having one record with that
> data in the database. Effectively this gives me something like
> 'multi-polygons'.
> For the next step in my process, I need all centroids to have unique
> cats, with their own attributes-record in the database. I have to
> 'split' the 'multi polygons' (in geometry-terms) so to say.

You try with v.category layer=2 op=add to create new unique cat values 
for you centroids in layer 2, v.db.addtable to create and attribute 
table for layer 2 and then v.to.db [...] layer=2 op=query qlayer=1 
qcolumn=cat to get the original cat values into the new attribute table.

> p.s. Some years ago, doing something similar, I did not have this
> problem, and dissolve returned a fresh cat for every area, with its
> attributes in the database table.

Could you give the exact commands and version of GRASS you use ?


More information about the grass-user mailing list