ExportRasterStack: Export a Raster Stack

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/ExportRasterStack.R

Description

Write a raster-stack, a collection of raster layers, to local directories using multiple file formats.

Usage

1
ExportRasterStack(rs, path, zip = "", col = NULL)

Arguments

rs

'RasterStack' or 'RasterBrick'. Collection of RasterLayer objects with the same extent and resolution.

path

'character' string. Path name to write raster stack.

zip

'character' string. If there is no zip program on your path (on windows), you can supply the full path to a ‘zip.exe’ here, in order to make a KMZ file.

col

'character' vector. Color names

Details

Five local directories are created under path and named after their intended file formats: Comma-Separated Values (‘csv’), Portable Network Graphics (‘png’), Georeferenced TIFF (‘tif’), R Data (‘rda’), and Keyhole Markup Language (‘kml’). For its reference system, ‘kml’ uses geographic coordinates: longitude and latitude components as defined by the World Geodetic System of 1984. Therefore, the conversion of gridded data between cartographic projections may introduce a new source of error.

Value

Invisible NULL

Note

If the zip program is unavailable on windows, install it by downloading the latest binary version from the Info-ZIP website; select one of the given FTP locations, enter directory ‘win32’, download ‘zip300xn.zip’, and extract.

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
rs <- raster::stack(system.file("external/rlogo.grd",
                                package = "raster"))
print(rs)
path <- file.path(getwd(), "rlogo")
dir.create(path)
ExportRasterStack(rs, path)
list.files(normalizePath(path, winslash = "/"),
           full.name = TRUE, recursive = TRUE,
           include.dirs = TRUE)

unlink(path, recursive = TRUE)

## End(Not run)

inlmisc documentation built on Jan. 25, 2022, 1:14 a.m.