I’d like to save a “names” attribute in a GeoTIFF using r.out.gdal
in GRASS GIS so that when the file is opened other software, the “name” is included. For example, in GRASS I can do:
r.out.gdal input=myraster output=C:/!scratch/myraster.tif createopt=PROFILE=GeoTIFF,COMPRESS=LZW,PREDICTOR=2, type=UInt16, -c -overwrite
When I “source” the file in, say, terra
(in R), I get:
library(terra)
rast('C:/!scratch/myraster.tif')
class : SpatRaster
dimensions : 1024, 626, 1 (nrow, ncol, nlyr)
resolution : 59.85157, 59.85157 (x, y)
extent : 731581.6, 769048.6, 1024437, 1085725 (xmin, xmax, ymin, ymax)
coord. ref. : Tananarive (Paris) / Laborde Grid
source : elev.tif
name : myraster
Note the last attribute, “name”, is the name of the file in GRASS, which can only be changed by renaming the file in GRASS.
I have tried messing with createopt
and metaopt
, as in for example, metaopt=TIFFTAG_IMAGEDESCRIPTION=Test
, but this fails (and produces a file that is not a valid raster).
How can I set this value using r.out.gdal
?