[GRASS-dev] Re: [GRASS-user] vector layer labelling doesn't work....

Moritz Lennert mlennert at club.worldonline.be
Sun Aug 10 12:11:12 EDT 2008

On 10/08/08 17:37, Michael Barton wrote:
> On Aug 9, 2008, at 5:48 AM, <grass-user-request at lists.osgeo.org> wrote:
>> I have no definite opinion on this, but I see Giovanni's point and I
>> think the latest patch I posted responds to this: labelling areas when
>> areas+labelling is asked for, without showing centroids...
>> So, let's ask for more opinions: should labelling of areas be linked to
>> centroids only, and thus display of centroids obligatory for seeing
>> labels for areas, or should labels for areas be displayed even if
>> centroids aren't ?
>> I filed this as an enhancement ticket on Trac:
>> http://trac.osgeo.org/grass/ticket/252, so maybe discussion should go on
>> there.
> Let me suggest something more radical, since we're rethinking this for 
> GRASS 7 too.
> Do we really NEED an explicit and user accessible vector area centroid? 
> What for?
> The "centroid" is NOT in the center of an area poygon. It can be 
> anywhere inside. It is only a place holder to differentiate an area from 
> a boundary. It is a feature of GRASS's internal structure for creating 
> vector objects from primitives. It currently also serves as the area 
> labeling point, but annoyingly has to be displayed just to see a label. 
> But what else does it do from the GIS use point of view?
> I suggest the following...
> 1) Area centroids should always be created by GRASS (not by a user 
> clicking a point somewhere in the area), and they should be the 
> geographic centroid of the area. In this way, they have topological 
> significance and can be used for some vector operations.

That is not possible as sometimes the geographic centroid of an area 
lies outside the area.

> 2) Area centroids are never displayed by default, but like line 
> directions can be displayed and accessed if needed.

This should just be a very minor change in d.vect, i.e.

--- main.c      2008-08-10 17:53:47.000000000 +0200
+++ main.c.copy 2008-08-10 17:54:22.000000000 +0200
@@ -139,7 +139,7 @@

      /* Query */
      type_opt = G_define_standard_option(G_OPT_V_TYPE);
-    type_opt->answer = "point,line,boundary,centroid,area,face";
+    type_opt->answer = "point,line,boundary,area,face";
      type_opt->options = "point,line,boundary,centroid,area,face";
      type_opt->guisection = _("Query");

> 3) Area centroids can be associated with labels or not be associated 
> with labels. I can see utility of doing either.

I think the question goes beyond labels. Centroids are the main element 
representing areas. Attributes are attached to centroids, as areas do 
not have a "physical" representation, which IIUC is due to the 
topological logic of GRASS features, as you cannot unambigously 
associate identify the area a boundary belongs to, so you need something 
inside the area. So, by definition, any attribute information pertaining 
to areas is associated with the centroid.


More information about the grass-user mailing list