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

Hi all,
it's the first time I try to use labelling on a polygonal vector layer
in grass 6.4.svn, and I can't make it work.

d.vect map=sst_sardegna@CRA-TASK2 -c color=0:0:0 lcolor=0:0:0
fcolor=170:170:170 display=shape,attr type=point,line,boundary,area
icon=basic/circle size=5 layer=1 {att=UC_SIGLA} lsize=10 xref=left
yref=center llayer=1

This is the command on the output display. It sets {att=UC_SIGLA} (why
does it use parenthesis?) but no labels are displayed...

Giovanni

On 08/08/08 11:06, G. Allegri wrote:

Hi all,
it's the first time I try to use labelling on a polygonal vector layer
in grass 6.4.svn, and I can't make it work.

d.vect map=sst_sardegna@CRA-TASK2 -c color=0:0:0 lcolor=0:0:0
fcolor=170:170:170 display=shape,attr type=point,line,boundary,area
icon=basic/circle size=5 layer=1 {att=UC_SIGLA} lsize=10 xref=left
yref=center llayer=1

You need to add centroid to the list of types. The label is attached to the centroid and if you do not display that, the label won't display either. If you're annoyed by the centroid circle, set its size to 1 which makes it hardly visible.

Moritz

2008/8/8 Moritz Lennert <mlennert@club.worldonline.be>:

You need to add centroid to the list of types. The label is attached to the
centroid and if you do not display that, the label won't display either. If
you're annoyed by the centroid circle, set its size to 1 which makes it
hardly visible.

I usually set to basic/point, size 1. Hardly noticeable at all.

--
Paulo Marcondes = PU1/PU2PIX
-22.915 -42.224 = GG86jc

Thanks Moritz, sorry for the stupid question...staying all the day in
front of the screen I coudn't see I was missing centroids :slight_smile:

2008/8/8 Moritz Lennert <mlennert@club.worldonline.be>:

On 08/08/08 11:06, G. Allegri wrote:

Hi all,
it's the first time I try to use labelling on a polygonal vector layer
in grass 6.4.svn, and I can't make it work.

d.vect map=sst_sardegna@CRA-TASK2 -c color=0:0:0 lcolor=0:0:0
fcolor=170:170:170 display=shape,attr type=point,line,boundary,area
icon=basic/circle size=5 layer=1 {att=UC_SIGLA} lsize=10 xref=left
yref=center llayer=1

You need to add centroid to the list of types. The label is attached to the
centroid and if you do not display that, the label won't display either. If
you're annoyed by the centroid circle, set its size to 1 which makes it
hardly visible.

Moritz

2008/8/8 G. Allegri <giohappy@gmail.com>:

Thanks Moritz, sorry for the stupid question...staying all the day in
front of the screen I coudn't see I was missing centroids :slight_smile:

You're not alone =]

that ocurred to me once.

Maybe, we should ask devels to change default d.vect behaviour, so
when labeling is selected, centroids should be automagically selected
too?
--
Paulo Marcondes = PU1/PU2PIX
-22.915 -42.224 = GG86jc

Hi,

2008/8/8 Paulo Marcondes <paulomarcondes@gmail.com>:

Maybe, we should ask devels to change default d.vect behaviour, so
when labeling is selected, centroids should be automagically selected
too?

it would be too much "user-friendly" from my point of view, then maybe
d.vect would be not my friend anymore;-)) I would leave decision on
the user, which feature types will be displayed...

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

Anyway I will change in my build :slight_smile:

gui/tcltk/gis.m/vector.tcl - Line 143:
set opt($count,1,type_centroid) 0 -> set opt($count,1,type_centroid) 1

2008/8/8 Martin Landa <landa.martin@gmail.com>:

Hi,

2008/8/8 Paulo Marcondes <paulomarcondes@gmail.com>:

Maybe, we should ask devels to change default d.vect behaviour, so
when labeling is selected, centroids should be automagically selected
too?

it would be too much "user-friendly" from my point of view, then maybe
d.vect would be not my friend anymore;-)) I would leave decision on
the user, which feature types will be displayed...

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

On Fri, 2008-08-08 at 17:07 +0200, Martin Landa wrote:

Hi,

2008/8/8 Paulo Marcondes <paulomarcondes@gmail.com>:
> Maybe, we should ask devels to change default d.vect behaviour, so
> when labeling is selected, centroids should be automagically selected
> too?

it would be too much "user-friendly" from my point of view, then maybe
d.vect would be not my friend anymore;-)) I would leave decision on
the user, which feature types will be displayed...

Martin

What about a warning message "centroid displaying enabled?" when using
"llayer" option?

Cheers, Nikos

Hi,

2008/8/8 G. Allegri <giohappy@gmail.com>:

Anyway I will change in my build :slight_smile:

gui/tcltk/gis.m/vector.tcl - Line 143:
set opt($count,1,type_centroid) 0 -> set opt($count,1,type_centroid) 1

in wxGUI it takes default d.vect type options, so
"point,line,boundary,centroid,area,face". Not sure why TCL/TK differs
here.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

2008/8/8 Martin Landa <landa.martin@gmail.com>:

Hi,

2008/8/8 Paulo Marcondes <paulomarcondes@gmail.com>:

Maybe, we should ask devels to change default d.vect behaviour, so
when labeling is selected, centroids should be automagically selected
too?

it would be too much "user-friendly" from my point of view, then maybe
d.vect would be not my friend anymore;-)) I would leave decision on
the user, which feature types will be displayed...

You might be right.
I thought of this, because it seems to be a common GRASS-newbie mistake.
But also, that is a mistake one only commits once. (or just a few times)

--
Paulo Marcondes = PU1/PU2PIX
-22.915 -42.224 = GG86jc

On 08/08/08 17:13, Martin Landa wrote:

Hi,

2008/8/8 G. Allegri <giohappy@gmail.com>:

Anyway I will change in my build :slight_smile:

gui/tcltk/gis.m/vector.tcl - Line 143:
set opt($count,1,type_centroid) 0 -> set opt($count,1,type_centroid) 1

That means always displaying centroids, not only when labelling is set.

in wxGUI it takes default d.vect type options, so
"point,line,boundary,centroid,area,face". Not sure why TCL/TK differs
here.

It was decided quite a while ago that having those circles by default was a bit annoying (even worse with the crosses) and that in most cases, when one wants to display areas, one does not need the centroids.

On 08/08/08 17:07, Martin Landa wrote:
> 2008/8/8 Paulo Marcondes <paulomarcondes@gmail.com>:
>> Maybe, we should ask devels to change default d.vect behaviour, so
>> when labeling is selected, centroids should be automagically selected
>> too?
>
> it would be too much "user-friendly" from my point of view, then maybe
> d.vect would be not my friend anymore;-)) I would leave decision on
> the user, which feature types will be displayed...

Could you elaborate on this ? I think that it seems logical to do what the user asks for. When labelling is asked for, this means the user wants the labels to appear, so automagically setting centroid display in that case doesn't seem too much interference to me...

Moritz

2008/8/8 Moritz Lennert <mlennert@club.worldonline.be>:

On 08/08/08 17:13, Martin Landa wrote:

Hi,

gui/tcltk/gis.m/vector.tcl - Line 143:
set opt($count,1,type_centroid) 0 -> set opt($count,1,type_centroid) 1

That means always displaying centroids, not only when labelling is set.

Yes. I set it this way because I prefer having centroids by default...

It was decided quite a while ago that having those circles by default was a
bit annoying (even worse with the crosses) and that in most cases, when one
wants to display areas, one does not need the centroids.

If I'm not wrong centroids were set on by default. I didn't make this
"mistake" before, but I've used labeling lot of times.

If I'm not wrong centroids were set on by default. I didn't make this
"mistake" before, but I've used labeling lot of times.

I mean, in some previous versions...

On 08/08/08 17:34, G. Allegri wrote:

If I'm not wrong centroids were set on by default. I didn't make this
"mistake" before, but I've used labeling lot of times.

I mean, in some previous versions...

see http://lists.osgeo.org/pipermail/grass-dev/2007-February/028873.html and following, notably
http://lists.osgeo.org/pipermail/grass-dev/2007-February/028908.html

So, it's been off since 1 1/2 year, at least in trunk...

But, to come back to the labelling issues, AFAICT, all it would take is this:

Index: display/d.vect/main.c

--- display/d.vect/main.c (révision 32646)
+++ display/d.vect/main.c (copie de travail)
@@ -565,6 +565,7 @@
             break;
         case 'a':
             display |= DISP_ATTR;
+ type |= GV_CENTROID;
             break;
         case 'z':
             display |= DISP_ZCOOR;

Martin, are you really against this ? Anyone else ? Otherwise, I would commit.

Moritz

Hi,

2008/8/8 Moritz Lennert <mlennert@club.worldonline.be>:

But, to come back to the labelling issues, AFAICT, all it would take is
this:

Index: display/d.vect/main.c

--- display/d.vect/main.c (révision 32646)
+++ display/d.vect/main.c (copie de travail)
@@ -565,6 +565,7 @@
           break;
       case 'a':
           display |= DISP_ATTR;
+ type |= GV_CENTROID;
           break;
       case 'z':
           display |= DISP_ZCOOR;

Martin, are you really against this ? Anyone else ? Otherwise, I would
commit.

I would hesitate to add GV_CENTROID automatically when displaying
labels. Attributes are connected to the primitives like points,
centroids, lines or boundaries, not areas! In d.vect when you ask to
display 'area', you ask for filling areas, nothing else. Labels are
not connected to areas but to the centroids. So you basically cannot
ask to display area labels. This should be explained in d.vect manual
rather then changing the code. Just my opinion.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

I would hesitate to add GV_CENTROID automatically when displaying
labels. Attributes are connected to the primitives like points,
centroids, lines or boundaries, not areas! In d.vect when you ask to
display 'area', you ask for filling areas, nothing else. Labels are
not connected to areas but to the centroids. So you basically cannot
ask to display area labels. This should be explained in d.vect manual
rather then changing the code. Just my opinion.

Yes, ok Martin. But that would be for "user-friendness". Conceptually,
with your logic, also d.what.vect should work only if a centroid is
clicked, not on the whole area...
Centroids are borned to make areas exist, so they're conceptually
strongly related, so it doesn't appear an error to me to consider
labels (attributes) directly related to areas... my two cents. I
repeat, just for "user-friendness"