[GRASS-dev] [GRASS GIS] #2143: d.legend: add option to output legend definition as text

GRASS GIS trac at osgeo.org
Fri Dec 13 13:45:16 PST 2013

#2143: d.legend: add option to output legend definition as text
 Reporter:  wenzeslaus             |       Owner:  grass-dev@…              
     Type:  enhancement            |      Status:  new                      
 Priority:  trivial                |   Milestone:  7.0.0                    
Component:  Display                |     Version:  svn-trunk                
 Keywords:  d.legend, text output  |    Platform:  All                      
      Cpu:  All                    |  
 It would be nice if `d.legend` provides a textual output instead of
 drawing the legend on the monitor/display. Then the legend definition can
 be used to create a GRASS-generated legend in some other context such as
 interactive GUI legend or HTML web site.

 Output format should be easily parsable. However, I haven't considered all
 the possibilities of `d.legend` output. For category maps, it is seems to
 be easy, only the category labels can make it harder:

 green forest
 blue lakes
 black roads

 The gradient legends are bigger problem. The gradient itself might be
 simple, e.g. CSS syntax is:
 red 10%, green 90%, blue 95%
 However, how the color breaks are defined and is this compatible between
 different environments? And How to define labels which might be placed at
 different positions than color breaks?

 The output should be file or stdout. I'm not sure about option name; it
 should not be confused with output of an image to the file (which is not

 I guess that it is possible to create this functionality using library or
 maybe even other modules but `d.legend` already has the functionality to
 generate legend and it has the interface to control it with all the fine

 This ticket is related to #89 which requests the definition as an input
 for drawing. Implementing both will cause that `d.legend` looses its core
 and becomes just a converter of one legend definition to another. However,
 I hope that `d.legend` can handle this loss of identity.

Ticket URL: <https://trac.osgeo.org/grass/ticket/2143>
GRASS GIS <http://grass.osgeo.org>

More information about the grass-dev mailing list