obtain: Obtain spatial datasets

Description Usage Arguments Details Value Examples

View source: R/obtain.R

Description

Extract information from various spatial (raster) dataseries both from local and online resources.

Usage

1
obtain(data = NULL, mask = NULL)

Arguments

data

[list(.)]
algorithm in which the operators to load spatial datasets are specified. Each operator is a list iteself and includes the operator name and its arguments as sub-elements; see Examples.

mask

[geom | Spatial* | sf]
spatial object. The extent of vertices that are part of the same feature is used to subset the spatial information.

Details

obtain expects a root directory in which an individual directory for each dataset dwells, where in turn all the files of this particular dataset are located. rasterTools provides a list of paths getOption("rtPaths"), which contains the directories and urls of the local and online resources. In case the dataset files are not available locally and if a url is available, an attempt to download the files is undertaken. That means typically you do not have to use the dataset specific download* functions manually, they are documented nevertheless for those who are interested. In case an error occurs, it might be necessary to specify new paths in rtPaths (see setPaths).

Recently supported datasets are

Value

A list of objects that is organised according to the stratification in data. The first hierarchical level of the list contains all the spatial units/masks. The second level contains an entry for each dataset and its temporal extent. The third level contains the resulting output. Mostly this would be an extracted raster according to what has been specified in the arguments, but for some operators the output is a data.frame or SpatialPointsDataFrame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
require(magrittr)

# specify the datasets for which you want to get data
myDatasets <- list(list(operator = "oGFC", years = c(2005:2007)),
                   list(operator = "oMODIS", product = "mod17a3", period = 2006,
                        layer = 2))

# grab the data
myData <- obtain(data = myDatasets, mask = rtGeoms$locations)

## End(Not run)

EhrmannS/rasterTools documentation built on Sept. 4, 2019, 10:34 a.m.