Opened 12 years ago

Closed 9 years ago

#1263 closed defect (fixed)

GUI d.legend tool gives error

Reported by: epatton Owned by: grass-dev@…
Priority: normal Milestone: 6.5.0
Component: wxGUI Version: svn-develbranch6
Keywords: d.legend Cc:
CPU: x86-64 Platform: Linux


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.

~ Eric.

Attachments (1)

Legend_tool_error.txt (625 bytes ) - added by epatton 12 years ago.

Download all attachments as: .zip

Change History (4)

by epatton, 12 years ago

Attachment: Legend_tool_error.txt added

comment:1 by hamish, 12 years ago

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.


comment:2 by epatton, 12 years ago

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.

~ Eric.

comment:3 by annakrat, 9 years ago

Resolution: fixed
Status: newclosed

Seems to be working now, traceback no longer appears. Instead there is only the d.legend 'out of range' error message which is ok.

Note: See TracTickets for help on using tickets.