I have a large raster on file. It can be read like so:
my_rast <- rast("my_large_file.tif")
names(my_rast)
[1] "value_a"
Using R or command-line GDAL I would like to change the name of the layer to something different, without totally re-writing the whole raster. How can I do this?
Note: I see there is a command in the Python rasterio library to do this, but I don't see a similar one in R.
You can now use the
update(x, names=TRUE)to write the changed layer names to disk (for file formats that support layer names, such as GTiff).Example data
Change the names, and write them to the file.
Show that it worked