### read GAEZ slope dataset
readGAEZslope <- function() {
dat <- NULL
if(rCache) dat <- readCache(); fromcache=T
if(is.null(dat)) {
dat <- rgdal::readOGR(paste0(geodata$config$mainfolder, "/FF/", "Frontier_Forests.shp"), layer="Frontier_Forests")
fromcache=F
if(rasterize) {
if ( (is.null(rast) & is.null(res)) | (!is.null(rast) & !is.null(res)) ) stop("Either 'rast' or 'res' have to be specified")
if(!is.null(rast)) {
if (!attr(class(r), "package") == "raster") stop("'rast' has to be a raster object")
r <- rast
} else if (!is.null(res)) {
r <- raster::raster()
raster::res(r) <- res
}
dat <- raster::rasterize(dat, r, getCover=getCover)
}
}
if (wCache & !fromcache) writeCache(dat)
return(dat)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.