#1263: GUI d.legend tool gives error
----------------------+-----------------------------------------------------
Reporter: epatton | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 6.5.0
Component: wxGUI | Version: svn-develbranch6
Keywords: d.legend | Platform: Linux
Cpu: x86-64 |
----------------------+-----------------------------------------------------
Hi, This error occurs when using the 'Add Map Elements' tool on the Map
Display window: when the categories given in the 'use' parameter exceed
the range of raster values in the map, the attached error is output to the
Layer Manager.
In the North Carloina demo location, add the elevation map to the display,
then add a legend using the tool, and give a range of values in the 'use'
parameter that exceeds the raster range. I used the following:
use=50,70,90,110,125,150 (the lowest value in the map is 55)
The module should probably exit more gracefully when values outside the
range are given.
{{{
GRASS65:nc_spm_08> d.legend elevation use=50,70,90,110,125,150
ERROR: use=50 out of range [55.579, 156.330] (extend with range= ?)
}}}
but using range= will not work if the underlying color table has no rules
for out of range values. (the hint doesn't help much here)
{{{
GRASS65:nc_spm_08> r.colors elevation color=rules
Enter rules, "end" when done, "help" if you need it.
fp: Data range is 55.5787925720215 to 156.329864501953
> 0 blue
> 33.333 cyan
> 66.667 yellow
> 200 red
> end
Color table for raster map <elevation> set to 'rules'
GRASS65:nc_spm_08> d.legend elevation use=50,70,90,110,125,150
range=50,150
WARNING: Color range exceeds lower limit of actual data
}}}
(despite that warning it then draws ok)
so the problem here is that the wxGUI is not catching+passing the
warning/error messages to the user?
alternatively the error could be relaxed so out of (color table, not map)
range requests display the null value (nv) color rule, but I'm not a fan
of that. while it's not quite undefined, it is generally not what you
want.
Yes, the problem is that you get a nasty wxpython error in the output
window instead of the error message you posted from the command line use
of d.legend.