[GRASS-dev] [GRASS GIS] #2083: Add 3D raster (volume) support to d.legend

GRASS GIS trac at osgeo.org
Mon Mar 24 20:56:50 PDT 2014


#2083: Add 3D raster (volume) support to d.legend
--------------------------------+-------------------------------------------
 Reporter:  wenzeslaus          |       Owner:  grass-dev@…              
     Type:  enhancement         |      Status:  new                      
 Priority:  normal              |   Milestone:  7.0.0                    
Component:  Display             |     Version:  svn-trunk                
 Keywords:  d.legend, raster3d  |    Platform:  All                      
      Cpu:  All                 |  
--------------------------------+-------------------------------------------

Comment(by wenzeslaus):

 New patch for G7:d.legend added. It adds new option `rast3d` to `d.legend`
 and renames option `map` to `rast`. Tested with:
  * `d.mon png`
  * `d.mon wx0`
  * g.gui (2D and 3D)

 Patch breaks API (backwards compatibility), so I fixed also wxGUI and
 `d.rast.leg` (which I didn't test). wxGUI 2D works the same way as before
 including the case of wrong legend parameters (both dialog and legend
 disappears but it is possible to show dialog by re-hiding and re-showing
 legend). wxGUI 3D works also in the same way (wrong parameters cause
 segmentation fault). No explicit support for 3D raster added to GUI, this
 would be nice in the future.

 GUI section with `rast` and `rast3d` is called `Input`, is that correct?

 Please review the patch.

 {{{
  > d.legend --help
 Description:
  Displays a legend for a raster or 3D raster map.


 Usage:
  d.legend [-vcnsfs] [rast=name] [rast3d=name] [color=name]
    [lines=value] [thin=value] [labelnum=value] [at=bottom,top,left,right]
    [use=value[,value,...]] [range=min,max] [font=string] [fontscale=value]
    [path=name] [charset=string] [--help] [--verbose] [--quiet]
 ...
 Parameters:
        rast   Name of raster map
                Either this option or rast3d option must be specified
      rast3d   Name of 3D raster map
                Either this option or rast option must be specified
 ...
 }}}

 I did not tested new legend with other GUI tools. User documentation not
 updated yet. To test basic case, use:
 {{{
 # generate data
 r3.mapcalc "test_2 = row()"

 # set some color table
 r3.colors map=test_2 color=elevation

 # use non-gui monitor
 d.mon png out=legend_3d.png

 # try some legends
 d.legend rast3d=test_2 at=10,50,10,20
 d.legend rast3d=test_2 at=10,50,30,40 use=10,20,50
 }}}

 Question: How to get nice error message for 3D raster?
 {{{
  > d.legend rast=xxxx
 ERROR: Raster map <xxxx> not found
  > d.legend rast3d=xxxx
 WARNING: Unable to open range file for [xxxx in ]
 WARNING: color support for [xxxx] in mapset [] missing
 ERROR: Color file for <xxxx> not available
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2083#comment:5>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list