[GRASS-dev] vector group by based on attribute table

Moritz Lennert mlennert at club.worldonline.be
Wed Mar 4 07:29:03 PST 2015


On 04/03/15 15:14, Pietro wrote:
> Dear all,
>
> I'm looking for a GRASS module that unify the geometries and the
> values, If I have a configuration like:
>
> geo features  |  cat   |   id | A  | B
> geofeature1 => cat1, id1, a1, b1
> geofeature2 => cat2, id1, a2, b2
> geofeature3 => cat3, id2, a3, b3
> geofeature4 => cat4, id2, a4, b4
> geofeature5 => cat5, id2, a5, b5
>
> I would like to have something like:
>
> SELECT id, mean(A) as meanA, mean(B) as meanB FROM table GROUP BY id;
>
> geo features           |  cat   | meanA      | meanB
> geo1, geo2           => id1, mean(a1, a2), mean(b1, b2)
> geo3, geo4, geo5 => id2, mean(a3, a4, a5), mean(b3, b4, b5)
>
 > There is already something to do this simple operation?
 > Do you have any suggestions?
 >


Does this mean you want to fusion the geofeatures (thus imlying that 
they are adjacent) or do you want to group them in a sort of typology ?

If the first, then it should probably be possible to integrate this into 
v.dissolve.

If the second, I could imagine a combination of v.reclass / v.category 
to create a new/second layer and then your SQL query to populate the 
table of that layer.

Moritz


More information about the grass-dev mailing list