Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

metadata

Metadata


Description

Get or set a metadata to a Raster object

Usage

## S4 method for signature 'Raster'
metadata(x)
metadata(x) <- value

Arguments

x

Raster* object

value

list with named elements. Each element may be another list of named elements (but these nested lists are not allowed to be lists themselves)

Value

Raster* object or list

Note

The metadata can contain single values or vectors of basic data types (character, integer, numeric) and Date. Some other types may also be supported. You cannot use a matrix or data.frame as a meta-data element.

Examples

r <- raster(nc=10, nr=10)
values(r) <- 1:ncell(r)

m <- list(wave=list(a=1, b=2, c=c('cool', 'important')), that=list(red='44', blue=1:5,
       days=as.Date(c('2014-1-15','2014-2-15'))), this='888 miles from here', today=NA)

metadata(r) <- m

## Not run: 

x <- writeRaster(r, rasterTmpFile(), overwrite=TRUE)
metax <- metadata(x)

identical(metax, m)

# nested too deep
badmeta1 <- list(wave=list(a=1, b=2, c='x'), that=list(red='4', blue=list(bad=5)))
metadata(r) <- badmeta1

# missing names
badmeta2 <- list(wave=list(1, 2, c='x'), that=list(red='44', blue=14), this='8m')
metadata(r) <- badmeta2

# matrix not allowed
badmeta3 <- list(wave=list(a=1, b=matrix(1:4, ncol=2), c='x'), that=list(red='4'))
metadata(r) <- badmeta3

## End(Not run)

raster

Geographic Data Analysis and Modeling

v3.4-10
GPL (>= 3)
Authors
Robert J. Hijmans [cre, aut] (<https://orcid.org/0000-0001-5872-2872>), Jacob van Etten [ctb], Michael Sumner [ctb], Joe Cheng [ctb], Dan Baston [ctb], Andrew Bevan [ctb], Roger Bivand [ctb], Lorenzo Busetto [ctb], Mort Canty [ctb], Ben Fasoli [ctb], David Forrest [ctb], Aniruddha Ghosh [ctb], Duncan Golicher [ctb], Josh Gray [ctb], Jonathan A. Greenberg [ctb], Paul Hiemstra [ctb], Kassel Hingee [ctb], Institute for Mathematics Applied Geosciences [cph], Charles Karney [ctb], Matteo Mattiuzzi [ctb], Steven Mosher [ctb], Babak Naimi [ctb], Jakub Nowosad [ctb], Edzer Pebesma [ctb], Oscar Perpinan Lamigueiro [ctb], Etienne B. Racine [ctb], Barry Rowlingson [ctb], Ashton Shortridge [ctb], Bill Venables [ctb], Rafael Wueest [ctb]
Initial release
2021-05-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.