#3122: d.legend.vect: possibility to change text of displayed labels and select
labels to show/not show
-------------------------+-------------------------------------------------
Reporter: veroandreo | Owner: grass-dev@…
Type: | Status: new
enhancement |
Priority: normal | Milestone: 7.3.0
Component: Display | Version: unspecified
Resolution: | Keywords: d.legend.vect, gsoc2016,
CPU: | cartography
Unspecified | Platform: Unspecified
-------------------------+-------------------------------------------------
Comment (by lazaa):
Replying to [comment:7 veroandreo]:
> Replying to [comment:6 mlennert]:
> > Replying to [comment:5 veroandreo]:
> > > Replying to [comment:4 mlennert]:
> > > > Replying to [comment:3 veroandreo]:
> > > > > Replying to [comment:2 mlennert]:
> > > > > > Replying to [comment:1 annakrat]:
> > > > > > > Replying to [ticket:3122 veroandreo]:
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > I've been testing the new d.legend.vect and it is great
> > > > > > > >
> > > > > > > > However, I found that it would be even better if one could
change the label displayed. Not always the name of the vector map is the
best option, especially if one is displaying for example only one category
of an attribute. For instance, I have presence/absence points and only
want to display presence points. I'd like to be able to tweak the label to
be "presence" instead of the name of the vector map.
> > > > > > >
> > > > > > > This is already possible using d.vect parameter
legend_label.
> > > > >
> > > > > Oh, I missed that one
> > > > >
> > > > > > Yes, but this does not seem to like spaces. If I use a label
such as "Areas < 10e6" it only displays "Areas". Same with "Large Areas",
I only get "Large" in the display. It does not make any difference if I
enclose the text in quotes, or not.
> > > > >
> > > > > Same here
> > > > >
> > > > > Don't know how difficult it might be, but maybe it would be
easier (and more visible, probably) from a user point of view, if that
"legend_label" parameter would be integrated in d.legend.vect, instead of
having to set the label in d.vect to then have it displayed with
d.legend.vect
> > > >
> > > > I prefer to have it in d.vect as that is where the layer is
defined. In d.legend.vect, this would be awkward as a d.legend.vect call
could concern anything from 1-X layers and so potentially you would need X
text fields to define labels and X is not defined beforehand. So, I would
plead to keep it as is, but just to improve the handling of special
characters, including spaces, in the text.
> > >
> > > ok, I see... Shall we then open a different enhancement ticket for
"better handling of special characters and spaces in legend_label
parameter of d.vect" and keep this one for the possibility of choosing
which vector labels to show / not show in the vector legend??
> >
> > Special characters (e.g. accents) are handled without problems. The
only issue seems to be spaces.
> >
> > For labels, a white space in the d.vect legend_label parameter might
be an easy solution for not displaying labels.
> >
> > When you say in your original ticket:
> >
> > >Also, sometimes one has boundaries of countries or coastlines that
should go on the
> > >map but doesn't need to have a label in the legend.
> >
> > are you really speaking about the labels, or about the fact that you
would like to not have boundaries or coastlines in the legend at all ? If
the former, maybe the white space option (or writing 'None' or something
like that as the label) would be the easiest. If the latter, I guess the
best solution would probably be adding an 'no legend label' flag to
d.vect.
>
> Sorry if I was not clear enough. What I mean is, I want boundaries or
coastlines displayed in the map, but I don't want any legend or label for
them. I was just imaging something like a tick box where you can select
from the maps displayed which one you want legend for. For example, you
have country boundaries, rivers and bridges and you want boundaries to be
displayed in the final map, but you don't want a legend item for them, you
only want legend items/labels for rivers and bridges. The problem is that
currently, every map displayed have a line in the legend, unless you
disable the map. But then, you don't get the boundaries displayed.
>
> Hope it's clearer now
>
It's possible using {{{input}}}/{{{output}}} parameter. After adding all
layers (boundary, rivers, bridges) you call d.legend.vect module with
parameter output
{{{d.legend.vect -b at=10,40 output=legend_out}}}.
You get file you can edit:
{{{
boundary|legend/area|5|139:105:20|227:227:186|3|area|8
rivers|legend/line|5|232:146:34|200:200:200|2|line|10837
bridges|basic/cross2|10|red|white|0|point|160
}}}
After deleting first line and saving file as e.g. ''legend_in'' you run
d.legend.vect once again with {{{input}}} parameter
{{{d.legend.vect -b at=10,40 input=legend_in}}} and you get legend with
only two layers altough three layers are displayed in map window.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3122#comment:8>
GRASS GIS <https://grass.osgeo.org>