Learn R Programming

forestChange (version 1.0)

FCPolygon: Forest-Cover Polygon

Description

This function can retrieve and crop layers of Global Forest Change (GFC) using polygon geometries (i.e., GADM).

Usage

FCPolygon(pol = NULL, lyrs = c("treecover2000", "lossyear"), 
    path, url, pr.utm = TRUE, mc.cores = detectCores(), ...)

Arguments

pol

SpatialPolygonsDataFrame, or character. Polygon geometry, the name of a GADM, or such a name plus its corresponding higher-level unit. If NULL then a list of GADM units is printed, see getGADM.

lyrs

character. Vector of strings matching layer names in the GFC. Defaults 'treecover2000' and 'lossyear'.

path

character.Location of a directory with the GFC. This argument overrides the action of url.

url

character. Web resource with text files containing lists of URLs for the GFC layers. If missing then data from the application programming interface of GFC is retrieved, see GFCurls.

pr.utm

logical. Project to UTM crs.

mc.cores

numeric. The number of cores, see mclapply.

Additional arguments in getGADM.

Value

RasterStack, or set of GADM units.

Details

The GADM are imported using the in-package getGADM. Links to the data sets are obtained using the in-package GFCurls. Geographic extents in both the GADM and the GFC are intersected implementing HansenUrltoExtent. Common areas between GFC and GADM are cropped using two functions of the raster package: crop and rasterize. Depending on localization of the GADM unit, several GFC layers by data type might be required. This is done implementing the in-package FCMosaic. This function could be memory demanding if the extents of the polygons used to cut the GFC are big (30,000 km^2). For these cases, machines with RAM of 8 GB or greater should be used. In unix-alike systems, the package implements parallel execution, see parallel package.

References

Hansen, M. C., Potapov, P. V., Moore, R., Hancher, M., Turubanova, S. A. A., Tyukavina, A., ... & Kommareddy, A. (2013). High-resolution global maps of 21st-century forest cover change. science, 342(6160), 850-853.

Examples

Run this code
# NOT RUN {
## A list of departments of Colombia is printed:
 
# }
# NOT RUN {
 dep <- FCPolygon(level = 1)
 head(dep)
 
# }
# NOT RUN {
## Two adjacent layers of GFC must be bounded together before cropping
## the GFC data using the boundaries of the the municipality of
## 'Cumaribo' in Colombia. This is automatically developed by
## FCPolygon:
 
# }
# NOT RUN {
 cumariboArea <- FCPolygon(pol = 'Cumaribo')
 
# }
# NOT RUN {
## The name 'Mosquera' matchs two municipalities of Colombia. A
## corresponding department should be specified in the argument 'pol'
## of FCPolygon:
 
# }
# NOT RUN {
 mosquera <- FCPolygon('Mosquera')
 mosqueraNarinho <- FCPolygon(pol = c('Mosquera','Narino'))
 
# }

Run the code above in your browser using DataLab