downloadGFW | R Documentation |
This function downloads the necessary Global Forest Watch and CO2 Emission data for a given shapefile. The shapefile is transformed to its bounding box, projected to its central UTM Zone and a buffer is applied. The default buffer size is 5000 meteres, but it can be changes by the user. It uses gdal system calls to speed up the process. The raw files by default will be deleted, but they also can be kept on the disk. Note, the CO2 emission data is only available roughly between 30N and 30S and the function will fail if your input shapfiles extent plus buffer is extending beyond those limits. This function relies heavily on code published at https://github.com/azvoleff/gfcanalysis.
downloadGFW( shape, dataset = "GFC-2018-v1.6", basename = "Hansen_1.6", outdir = ".", keepTmpFiles = F, .tmpdir = tempfile(tmpdir = tempdir()) )
shape |
A |
dataset |
A |
basename |
A |
outdir |
A |
keepTmpFiles |
A |
.tmpdir |
A |
A vector
of type charachter
with all the files matching
the basename
pattern in the outdir
directory.
This function depends on available gdal binaries on your system. Make sure they are available as environment variables on your machine or use our docker image instead.
Darius Görgen (MapTailor Geospatial Consulting GbR) info@maptailor.net
Maintainer: MAPME-Initiative contact@mapme-initiative.org
Contact Person: Dr. Johannes Schielein
Copyright: MAPME-Initiative
License: GPL-3
## Not run: aoi = st_read(system.file("extdata", "aoi_polys.gpkg", package = "mapme.forest")) raster_files = downloadGFW(shape = aoi, basename = "pkgTest", outdir = "./data/", keepTmpFiles = T, .tmpdir = "./data/tmp") # resulting rasters are not automatically cropped to the extent of aoi rasters = stack(lapply(raster_files, function(f){ f = brick(f) f = crop(f, aoi) })) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.