R/rectify.R

Defines functions rotated

Documented in rotated

# Robert J. Hijmans
# May 2010
# Version 1.0
# Licence GPL v3


rotated <- function(x) {
	isTRUE(try(x@rotated, silent=TRUE))
}

setMethod("rectify", signature(x="Raster"), 
	function(x, ext, res, method='ngb', filename='', ...) {
		stopifnot(rotated(x))
		if ( missing(ext)) {
			ext <- extent(x)
		} else {
			ext <- extent(ext)
		}
		out <- raster(ext)
		if ( missing(res)) {
			res(out) <- abs(raster::res(x))
		} else {
			res(out) <- res
		}
		resample(x, out, method=method, filename=filename, ...)
	}
)

Try the raster package in your browser

Any scripts or data that you put into this service are public.

raster documentation built on Jan. 5, 2021, 3:01 a.m.