This functions allows to efficiently calculate treecover statistics for polygons. For each year in the analysis timeframe, the forest losses in preceding and the current years are subtracted from the treecover in the year 2000 and actual treecover figures within the polygon are returned. The required resources for this indicator are:
Details
The following arguments can be set:
- min_size
The minimum size of a forest patch to be considered as forest in ha.
- min_cover
The minimum cover percentage per pixel to be considered as forest.
Examples
if (Sys.getenv("NOT_CRAN") == "true") {
library(sf)
library(mapme.biodiversity)
temp_loc <- file.path(tempdir(), "mapme.biodiversity")
if (!file.exists(temp_loc)) {
dir.create(temp_loc)
resource_dir <- system.file("res", package = "mapme.biodiversity")
file.copy(resource_dir, temp_loc, recursive = TRUE)
}
(try(aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
package = "mapme.biodiversity"
) %>%
read_sf() %>%
init_portfolio(
years = 2016:2017,
outdir = file.path(temp_loc, "res"),
tmpdir = tempdir(),
add_resources = FALSE,
verbose = FALSE
) %>%
get_resources(
resources = c("gfw_treecover", "gfw_lossyear"),
vers_treecover = "GFC-2021-v1.9", vers_lossyear = "GFC-2021-v1.9"
) %>%
calc_indicators("treecover_area", min_size = 1, min_cover = 30) %>%
tidyr::unnest(treecover_area)))
}
#> Simple feature collection with 2 features and 7 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: -71.80933 ymin: 18.57668 xmax: -71.33201 ymax: 18.69931
#> Geodetic CRS: WGS 84
#> # A tibble: 2 × 8
#> WDPAID NAME DESIG_ENG ISO3 assetid years treecover geom
#> <dbl> <chr> <chr> <chr> <int> <int> <dbl> <POLYGON [°]>
#> 1 478140 Sier… National… DOM 1 2016 12011. ((-71.76134 18.66333, -7…
#> 2 478140 Sier… National… DOM 1 2017 11939. ((-71.76134 18.66333, -7…