Preserve GRASS raster labels
|Assigned to:||Victor Olaya||% Done:||
- GRASS raster can have labels (very convenient, e.g. r.param.scale saves
feature names along with categories)
- when saving to TIFF, these are stripped
- as a consequence, the flow DTM>Features raster>Feature vector strips
the categories, and data are lost.
Of course we can Use raster values as categories, but
keeping the labels would be much better. One way would be to pipe
directly the two GRASS commands, without exporting in between, but this is not implemented yet.
Notes from Etienne Tourigny:
labels could be added as GTIFF metadata, which GDAL supports but I
don't know how/if this could be done in GRASS
If the export is using r.out.gdal there must be a way to put/get
metadata in a gtiff?
Metadata key(s) and value(s) to include
In the form of "META-TAG=VALUE", separate multiple entries with a
comma. Not supported by all output format drivers.
Notes from Benjamin Ducke:
Theoretically, it wouldn't be very hard to read the labels
from the mapset in which SEXTANTE is storing the (temporary)
GRASS datasets; they are saved as plain ASCII there.
However, the host GIS for SEXTANTE must then somehow deal
with this additional data in some useful way (e.g. via a
virtual raster attribute table).
Updated by Paolo Cavallini 12 months ago
From Markus Metz, GRASS mailing list:
An alternative would be to make use of the GDAL raster attribute table
in both GRASS and QGIS, with the benefit that reading labels for other
raster maps imported with GDAL would also be supported.
IIUC, QGIS is currently using GDALGetRasterCategoryNames() which has
very limited functionality and supports only integer maps. In a GDAL
raster attribute table, as with GRASS-internal categories, floating
point values and data ranges are supported, e.g.
min=358.5, max=359.5, name=359 degrees ccw from east
A GDAL raster attribute table would also solve the problem of
importing/exporting color rules for floating point data types.