[GRASS-user] area calculation after dissolve

Moritz Lennert mlennert at club.worldonline.be
Wed Jun 29 08:16:44 PDT 2016


On 29/06/16 16:33, Uwe Fischer wrote:
> I have a polygon dataset which needs to be dissolved by a certain item.
> That works fine. But when I calculate the area size for the new created
> Polygons in the next step using v.to.db, I find that the system
> summarizes all the polygons with the same value in the dissolve item,
> even if they are remote from each other (I mean, they do not touch).
> That might be correct if I want to handle them like a multipart feature,
> but those are not present in GRASS as far as I know. What I need is the
> area for each single polygon after removing the inside borders, no
> matter what value the polygon has. How to calculate that?
>
> I found that polygons with the same dissolve item also have the same cat
> number, which might be the reason for the common area size. But I don't
> know how to clear that without losing the connection to the database
> table containing the dissolve item.

You could use v.category to assign individual cat values to each polygon 
on a different layer (e.g. layer=2), add a table to layer 2 using 
v.db.addtable and then v.to.db layer=2 to fill that table.

That way you will have one layer with the original (grouped) cat values 
and the related attributes and a second layer with the new (individual) 
cat values and the related attributes. If you need to combine the two 
into one table, you could add into the layer 2 table a column for the 
cat in layer 1 and fill that using, e.g. v.distance:

v.distance from=MyPolygons from_layer=2 to=MyPolygons to_layer=1 up=cat 
col=cat_lay1

Moritz


More information about the grass-user mailing list