[GRASS-user] RE : RE : Merge polygone with same attribut of a shapefile

BLANDENIER Lucien lucien.blandenier at unine.ch
Thu May 16 08:19:30 PDT 2013


Ok, but I will obtain statistics for each polygons separately and not a "global" statistic considering all the polygons of a same category? 

________________________________________
De : grass-user-bounces at lists.osgeo.org [grass-user-bounces at lists.osgeo.org] de la part de Vincent Bain [bain at toraval.fr]
Date d'envoi : jeudi 16 mai 2013 17:12
À : GRASS user list
Objet : Re: [GRASS-user] RE : Merge polygone with same attribut of a shapefile

Le jeudi 16 mai 2013 à 14:13 +0000, BLANDENIER Lucien a écrit :
> Thank you Vincent and Nikos for your answers,
>
> Of course I mean v.dissolve and not r.dissolve...
>
> Maybe I'm not clear enough wiht my problem...
>
> To explain what I want to obtain :
> I've created such a shapfile in qgis using the tool "add part". I have then one feature with two polygone (see attached files).
> Then I've imported this shapfile into GRASS and I also see one feature with two polygones.
>
> Is it possible to create such files with GRASS and in my case to merge different non-adjacent polygone into one polygone?

As Nikos said, grass vector topology does not allow this; no problem for
the hole in a polygon (an area inside it without centroid), but
non-contiguous areas will necessarily be considered as distinct areas.

>
> The reason of this is I have to do statistics (v.rast.stats) with this shp and I want to consider all the features of a category for calculating the stats and the feature separated. (e.g. I want to have the mean of all pixels contained in the polygones of the same category and for each polygones separately)
>
> regards

You could achieve your task with the help of categories. I mean, If you
assign a distinct category to each of your "multi-polygon-areas", you
can then identify/handle them individually.

e.g. run a loop on cat values, which:
*extracts polygons with cat=1 to a temporary vector,
*uses the temp map to perform your cross-analyses between vector and
raster data,
*iterates to the next cat value, overwriting the former temp map,
*and so on till the last cat.

Grass runs this kind of sequential tasks incredibly fast on hundreds of
iterations...

Yours,
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