[GRASS-dev] all categories copied over to new map

Moritz Lennert mlennert at club.worldonline.be
Wed Sep 16 00:49:24 PDT 2015


On 15/09/15 20:08, Paulo van Breugel wrote:
> Suppose I have a categorical raster map and I want to 'cut out' a subset
> (with g.region to set a small region and r.mapcalc to create the new
> map). This map has a smaller number of categories, as is shown using
> e.g., r.category. However, when plotting the legend, all the categories
> of the original map are included in the legend. Checking the 'cats' file
> shows that it indeed lists all original categories and labels, including
> for those categories not present in the new map. This doesn't make sense
> to me, but perhaps I am missing something here?

AFAIK, the legend is determined by the color table, and the color table 
is probably just copied as is from the input to the output map. You can 
check with r.colors.out. If you redefine a color table with only the 
relevant categories, then the legend should reflect that.

You could also try d.legend with the -n flag to only show categories 
which have a label.

Moritz


More information about the grass-dev mailing list