[GRASS-user] add a centroid in the center of polygon

Markus Metz markus.metz.giswork at gmail.com
Tue Jan 28 02:52:00 PST 2014


On Mon, Jan 27, 2014 at 9:38 AM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 25/01/14 12:52, Markus Metz wrote:
>>
>> On Sat, Jan 25, 2014 at 12:27 PM, Markus Neteler <neteler at osgeo.org>
>> wrote:
>>>
>>> On Sat, Jan 25, 2014 at 12:08 PM, Markus Metz
>>> <markus.metz.giswork at gmail.com> wrote:
>>>>
>>>> On Sat, Jan 25, 2014 at 12:10 AM, Milton Ribeiro
>>>> <miltinho.astronauta at gmail.com> wrote:
>>>>>
>>>>> Dear all,
>>>>>
>>>>> I have a polygon vector, and need to add point in the center of mass of
>>>>> each
>>>>> one.
>>>>> I used v.centroid, but it adds just a centroid, but not in the central
>>>>> position of the polygon area.
>>>>
>>>>
>>>> v.centerpoint from addons [0] does that.
>>>>
>>>> Markus M
>>>>
>>>> [0] http://grasswiki.osgeo.org/wiki/AddOns/GRASS7/vector#v.centerpoint
>>>
>>>
>>> Right, I forgot about this nice addon!
>>> Perhaps its functionality might be merged into v.centroids [1]?
>>
>>
>> No, because the center of mass is not always within the area.
>
>
> But couldn't that be a documented flag (e.g. something like this: 'always
> place centroid within the area (for GRASS polygon)').

Centroids must always be within the area. We can add the functionality
to v.category (v.centroids is just a wrapper for v.category) or
better, to the vector library, but then centroids are still not
guaranteed to be the center of mass.
>
> Personally, I support MarkusN's idea of merging the two, if that's possible
> from the code point of view. I find it more intuitive to look for a module
> creating centroids...

IMHO it will be confusing if there is a flag to calculate the center
of mass, but centroids are then not always the actual center of mass,
in which case it is safer to assume that centroids are not the center
of mass.

Markus M


More information about the grass-user mailing list