[GRASS5] [bug #2437] (grass) ps.map: raster colortable fails on dynamic cat names

Request Tracker grass-bugs at intevation.de
Sat May 29 02:59:10 EDT 2004


this bug's URL: http://intevation.de/rt/webrt?serial_num=2437
-------------------------------------------------------------------------

Subject: ps.map: raster colortable fails on dynamic cat names

Platform: GNU/Linux/i386
grass obtained from: Mirror of Trento site
grass binary for platform: Compiled from Sources
GRASS Version: 5.3 cvs may 2004

ps.map's raster colortable function doesn't work correctly when the cats file contains dynamic naming rules.

e.g. 'r.neighbors method=diversity' creates a cats/ file as follows:
# 6 categories
11x11 neighborhood: diversity of test_map
$1 $?different categories$category$
1.00 0.00 0.00 0.00

In  src/ps.map/ps.map/cmd/ps_clrtbl.c, line 55, there is:
    /* How many categories to show */
    num_cats = G_number_of_raster_cats(&PS.cats);

This gets set to 0 for the above map when it should be 6. (uses G_read_cats() to populate PS.cats several lines earlier)
Forcing it higher causes a SegFault.


It works with d.legend:
G_read_cats();
G_read_range(map_name, mapset, &range);
G_get_range_min_max (&range, &min_ind, &max_ind);
cats_num = max_ind - min_ind + 1 ;
[more or less, admittedly d.legend can be a bit convoluted..]


I take it this is a bug in G_number_of_raster_cats() or G_read_cats()?

I hadn't seen anything about dynamic category names before this. Any docs for it? Should it be supported?


thanks,
Hamish


-------------------------------------------- Managed by Request Tracker




More information about the grass-dev mailing list