split_raster: Split raster into tiles

Description Usage Arguments Details Value Author(s) References Examples

View source: R/split_raster.R

Description

Splits a rasterLayer into tiles

Usage

1
2
3
4
5
6
7
split_raster(
  file,
  s = 2,
  outputDir,
  gdalinfoPath = NULL,
  gdal_translatePath = NULL
)

Arguments

file

full path to a raster

s

division applied to each side of the raster (s=2 -> 4 tiles)

outputDir

path and directory name for output

gdalinfoPath

path to gdalinfo binary. Set to NULL if default search path is sufficient.

gdal_translatePath

path to gdal_translate binary. Set to NULL if default search path is sufficient.

Details

GDAL must be installed for this function to work. To determine if the default search paths are sufficient, you can type in R Sys.which('gdalinfo') and Sys.which('gdal_translate'). If a path is returned, then you can leave those arguments as NULL.

Value

Rasters are written to the output directory.

Author(s)

Pascal Title

References

GDAL. 2015. GDAL - Geospatial Data Abstraction Library: Version 1.11.3, Open Source Geospatial Foundation, https://gdal.org

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# Find example rasters
rasterFiles <- list.files(system.file('extdata', package='envirem'), full.names=TRUE)
tmin1file <- grep('tmin_1\\.', rasterFiles, value=TRUE)

We will split this raster into 4 tiles, that will be written to disk.
split_raster(tmin1file, s = 2, outputDir = '~/temp/', gdalinfoPath = NULL, 
		gdal_translatePath = NULL)

## End(Not run)

envirem documentation built on May 14, 2021, 9:06 a.m.