Feature request #13518
Add support for GRASS raster labels
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | GRASS | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 21562 |
Description
GRASS rasters can have value labes embedded in the format. Unfortunately, labels are not displayed in QGIS legend, thus missing an important piece of information. It would be good to have them.
History
#1 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
#2 Updated by Paolo Cavallini over 6 years ago
Still TBD in QGIS3
#3 Updated by Alister Hood over 6 years ago
QGIS 2.18.x at least loaded the GRASS raster categories and colours, and was only missing the labels. Here it seems that QGIS 3.x doesn't load in anything (or at least doesn't load it correctly) - sometimes GRASS rasters aren't even visible after I load them.
For those that actually work in GRASS, the r.category.trim module will export raster categories (including labels) for loading into QGIS, which may be a helpful workaround.
See https://pvanb.wordpress.com/2015/10/31/grass-gis-categorical-raster-layers-in-qgis/
#4 Updated by Alister Hood over 6 years ago
Alister Hood wrote:
... Here it seems that QGIS 3.x doesn't load in anything (or at least doesn't load it correctly) - sometimes GRASS rasters aren't even visible after I load them.
There are two issues:
1. QGIS doesn't zoom to the layer as it normally does if there are no other loaded layers.
2. The colour table isn't loaded (or just the wrong renderer is used or something). I can see the code for actually loading the colour table is still there - when I load the layers they default to the "singleband pseudocolour" renderer, and I can either classify or switch to another renderer to make them appear. If I switch to the "Paletted/Unique values renderer then the correct colour table is loaded, so I would only need r.category.trim to get the labels.
Incidentally, the behaviour loading layers with the GRASS provider is better than loading layers produced by GRASS algorithms. In the latter case, the correct colours are loaded, but they are part of a full palette i.e. 256 colours will show in the legend, when you might only need 2 (I assume this is a side effect of the way GRASS stores the colours in the .aux.xml file). In this case r.category.trim can't help you because you don't have the original GRASS layer (maybe you can track it down in the temporary directory, but here on Windows it lives in the AppData folder and that doesn't show up in the QGIS browser).