Set or get metadata
metags.Rd
You can set arbitrary metadata to a SpatRaster using "name=value" tags.
Usage
# S4 method for class 'SpatRaster'
metags(x, layer = NULL) <- value
# S4 method for class 'SpatRaster'
metags(x, layer=NULL, name=NULL)
Examples
r <- rast(ncol=5, nrow=5)
m <- cbind(c("one", "two", "three"), c("ABC", "123", "hello"))
metags(r) <- m
metags(r)
#> one three two
#> "ABC" "hello" "123"
metags(r) <- c("another_tag=another_value", "one more=this value")
metags(r)
#> another_tag one one more three two
#> "another_value" "ABC" "this value" "hello" "123"
metags(r) <- c(another_tag="44", `one more`="that value")
metags(r)
#> another_tag one one more three two
#> "44" "ABC" "that value" "hello" "123"
metags(r, name="two")
#> two
#> "123"
# remove a tag
metags(r) <- cbind("one", "")
metags(r) <- "two="
metags(r)
#> another_tag one more three
#> "44" "that value" "hello"
# remove all metags
metags(r) <- NULL
metags(r)
#> named character(0)