warpVCF: Warping utility

Description Usage Arguments Details Value Warning Author(s) References Examples

Description

Warps (mosaic, reproject, resample), raster files to a projection set by the user. The function works by calling gdalwarp, which needs to be installed on the system.

Usage

1
2
warpVCF(x, t_srs, nodata = NULL, filename, res = 30, method = "bilinear",
  mc.cores = 1, run = TRUE, ...)

Arguments

x

character or list of character, the filenames of files to be warpped. The list can easily be retrieved using a call such as list.files('/path/to/data/', full.names=TRUE)

t_srs

character. proj4 expression of the output (filename) file.

nodata

numeric. Value that should not get interpolated in the resampling. Can take multiple values (i.e.: c(220, 210, 211)). No need to specify the nodata value if that one is included in the file header.

filename

character. filename of the output file, with full path.

res

numeric. output resolution.

method

character. resampling method. See http://www.gdal.org/gdalwarp.html

mc.cores

Numeric. Only relevant if length(nodata) > 1. Number of workers.

run

logical. should the warping be executed. If set to false, a gdalwarp command string is generated, but not executed.

...

Extra switches passed to gdalwarp, see http://www.gdal.org/gdalwarp.html.

Details

Requires gdal to be installed on the system, and the the gdal binary folder should be added to the system path. On windows systems, gdal can be install via FWTools, OSGeo4W or QGIS.

Value

A character, the gdalwarp command. If you inted to copy/past it in a terminal, you can use print(), with quote=FALSE.

Warning

For parallel implementation, see warning section of mclapply

Author(s)

Loic Dutrieux

References

http://www.gdal.org/gdalwarp.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
pr <- getPR('Belize')
pr
dir = tempdir()
downloadPR(pr, year=2000, dir=dir)
unpackVCF(pr=pr, year=2000, searchDir=dir, dir=sprintf('%s/%s',dir,'extract/'))
x <- list.files(sprintf('%s/%s',dir,'extract/'), full.names=TRUE)
filename <- sprintf('%s.tif', rasterTmpFile())
warpVCF(x=x, t_srs='+proj=laea +lat_0=-10 +lon_0=-70 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs', nodata = c(200, 210, 211, 220), filename=filename, '-multi')
a <- raster(filename)

## End(Not run)

loicdtx/VCF documentation built on May 21, 2019, 7:37 a.m.