cov_tile: Tiles a set of rasters

View source: R/cov_tiles.R

cov_tileR Documentation

Tiles a set of rasters

Description

Uses SpaDES.tools::splitRaster to generate tiles of a given set of rasters using parallel processing.

Usage

cov_tile(rList, output = "./tiles/", pxCount = 1000, index = TRUE)

Arguments

rList

a vector of files to process (e.g. list.files("e:/rasters", pattern= "*.tif"))

output

character, destination of output tiles. Note that a subdirectory for each raster given will be created within this folder.

pxCount

the maximum number of pixels in the x and y direction. pxCount squared will be the size of the output raster. Default of 1000 x 1000 pixels.

index

When TRUE genearates a shapefile tiles.shp – for each set of tiles generated.

Examples

r <- raster::raster(ncol=100, nrow=100) ## empty raster
r <- raster::setValues(r, rnorm(raster::ncell(r), 1)) ##
dir.create("e:/cv_tile")
raster::writeRaster(r, "e:/cv_tile/r.tif")
rasterList <- list.files("e:/cv_tile", full.names = TRUE) ## make sure this is the rasters only!

cv_tile(rList = rasterList, output = "e:/cv_tile",
        pxCount = 50, index = TRUE)
#> [1] "Tiling: r.tif ... 1 of 1"
#> [1] "Generating Tile index: e:/cv_tile/r_tiles/tileindex.gpkg"

list.files("e:/cv_tile", recursive = TRUE, full.names = TRUE)
#> [1] "e:/cv_tile/r.tif"
#> [2] "e:/cv_tile/r_tiles/r_tile1.grd"
#>[10] "e:/cv_tile/r_tiles/tileindex.gpkg"

ColinChisholm/pemGeneratr documentation built on March 18, 2023, 1:45 a.m.