qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.51k stars 2.99k forks source link

Add support for GRASS raster labels #21562

Open qgib opened 9 years ago

qgib commented 9 years ago

Author Name: Paolo Cavallini (@pcav) Original Redmine Issue: 13518

Redmine category:grass


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.

qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 6 years ago

Author Name: Paolo Cavallini (@pcav)


Still TBD in QGIS3

qgib commented 6 years ago

Author Name: Alister Hood (@AlisterH)


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/

qgib commented 6 years ago

Author Name: Alister Hood (@AlisterH)


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).

alexbruy commented 4 years ago

See also #15249.