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

Pietro peter.zamb at gmail.com
Wed Mar 4 07:35:44 PST 2015


On Wed, Mar 4, 2015 at 4:29 PM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> 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 ?

No, I don't want the fusion of the geometry features, I like the idea
of different/distinct geometry features with the same category.

> 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.

Ok, I will look into it, thanks for the suggestion.

Pietro


More information about the grass-dev mailing list