[GRASS-dev] vector legend implementation

Anna Petrášová kratochanna at gmail.com
Thu Jun 23 10:49:47 PDT 2016


I would like to get some feedback on the implementation of vector
legend which Adam will start working on soon as part of GSoC.

Basically, the implementation would be in Python using d.graph which
allows to draw shapes, symbols, lines and text.
The first implementation would solve only basic things.

GUI takes the series of d.vect commands and turns it into a text file in format:
symbol color1 color2 size width text

the legend symbols would be always the GRASS symbols, so even line,
areas would be symbols. We would add new symbols for lines and areas,
for example straight and crooked line, some irregular shape for areas.
color1 is outline color
color2 is fill color
size is symbol size
width is line width
text is legend label

so for example:

legend/line red none 5 2 State border

then each line of the legend will be drawn with d.graph.

This format could be general enough to support more complicated cases
(thematic vector?). What is not clear to me now is how the legend
module will be called from d.mon wx0 and cairo. In GUI, it can
automatically create this text file, but in d.mon cairo there is
currently no way to get the d.vect commands (d.save is not in G7). So
when scripting, users would have to write the input text file
specifying the legend. Or the input could be a list of d.vect commands
in a file if that would be more convenient. But when using d.mon wx0,
it would be convenient to use d.vect.legend without any parameters,
because the GUI knows the layers. So maybe we need some kind of
wrapper module on top of the lower level implementation. I am sorry if
this sounds confusing, but this can be decided later.

What about the name?

d.vect.legend (like t.vect.list)
d.legend.vect (like v.what.rast)

Thanks for any feedback,


More information about the grass-dev mailing list