metags: Set or get metadata

metagsR Documentation

Set or get metadata

Description

You can set arbitrary metadata to a SpatRaster using "name=value" tags.

Usage

## S4 replacement method for signature 'SpatRaster'
metags(x)<-value

## S4 method for signature 'SpatRaster'
metags(x, name=NULL)

Arguments

x

SpatRaster

name

character

value

character of "name=value" or two-column matrix

Value

SpatRaster (metags<-), or named character (metags)

Examples

r <- rast(ncol=5, nrow=5)
m <- cbind(c("one", "two", "three"), c("ABC", "123", "hello"))
metags(r) <- m
metags(r)

metags(r) <- c("another_tag=another_value", "one more=this value")
metags(r)

metags(r, "two")

# remove a tag
metags(r) <- cbind("one", "")
metags(r) <- "two="
metags(r)

# remove all metags
metags(r) <- NULL
metags(r)

terra documentation built on Oct. 13, 2023, 5:08 p.m.