Skip to contents

The land cover data shows us how much of the region is covered by forests, rivers, wetlands, barren land, or urban infrastructure thus allowing the observation of land cover dynamics over a period of time. This function allows to efficiently calculate area of different landcover classes for polygons. For each polygon, the area of the classes in hectare(ha) is returned.

Usage

calc_landcover()

Value

A function that returns an indicator tibble with landcover classes as variables and corresponding areas (in ha) as value.

Details

The required resources for this indicator are:

Examples

# \dontrun{
library(sf)
library(mapme.biodiversity)

outdir <- file.path(tempdir(), "mapme-data")
dir.create(outdir, showWarnings = FALSE)

mapme_options(
  outdir = outdir,
  verbose = FALSE
)

aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
  package = "mapme.biodiversity"
) %>%
  read_sf() %>%
  get_resources(get_esalandcover(years = 2016:2017)) %>%
  calc_indicators(calc_landcover()) %>%
  portfolio_long()
#> Warning: GDAL Message 1: HTTP response code on https://s3-eu-west-1.amazonaws.com/vito.landcover.global/v3.0.1/2016/W080N20/W080N20_PROBAV_LC100_global_v3.0.1_2016-conso_Discrete-Classification-map_EPSG-4326.tif: 403
#> Warning: GDAL Message 1: HTTP response code on https://s3-eu-west-1.amazonaws.com/vito.landcover.global/v3.0.1/2017/W080N20/W080N20_PROBAV_LC100_global_v3.0.1_2017-conso_Discrete-Classification-map_EPSG-4326.tif: 403
#> Error in (function (.x, .y, .f, ..., .progress = FALSE) {    map2_("list", .x, .y, .f, ..., .progress = .progress)})(.x = list(structure(list(filename = NA_character_, location = NA_character_,     type = NA_character_, oo = list(NULL), co = list(NULL), source = NA_character_,     geometry = structure(list(structure(list(), class = c("XY",     "GEOMETRYCOLLECTION", "sfg"))), class = c("sfc_GEOMETRY",     "sfc"), precision = 0, bbox = structure(c(xmin = NA_real_,     ymin = NA_real_, xmax = NA_real_, ymax = NA_real_), crs = structure(list(        input = NA_character_, wkt = NA_character_), class = "crs"), class = "bbox"), crs = structure(list(        input = "EPSG:4326", wkt = "GEOGCRS[\"WGS 84\",\n    ENSEMBLE[\"World Geodetic System 1984 ensemble\",\n        MEMBER[\"World Geodetic System 1984 (Transit)\"],\n        MEMBER[\"World Geodetic System 1984 (G730)\"],\n        MEMBER[\"World Geodetic System 1984 (G873)\"],\n        MEMBER[\"World Geodetic System 1984 (G1150)\"],\n        MEMBER[\"World Geodetic System 1984 (G1674)\"],\n        MEMBER[\"World Geodetic System 1984 (G1762)\"],\n        MEMBER[\"World Geodetic System 1984 (G2139)\"],\n        ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n            LENGTHUNIT[\"metre\",1]],\n        ENSEMBLEACCURACY[2.0]],\n    PRIMEM[\"Greenwich\",0,\n        ANGLEUNIT[\"degree\",0.0174532925199433]],\n    CS[ellipsoidal,2],\n        AXIS[\"geodetic latitude (Lat)\",north,\n            ORDER[1],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        AXIS[\"geodetic longitude (Lon)\",east,\n            ORDER[2],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n    USAGE[\n        SCOPE[\"Horizontal component of 3D system.\"],\n        AREA[\"World.\"],\n        BBOX[-90,-180,90,180]],\n    ID[\"EPSG\",4326]]"), class = "crs"), classes = "GEOMETRYCOLLECTION", n_empty = 1L),     destination = NA_character_), row.names = c(NA, -1L), sf_column = "geometry", agr = structure(c(filename = NA_integer_, location = NA_integer_, type = NA_integer_, oo = NA_integer_, co = NA_integer_, source = NA_integer_, destination = NA_integer_), levels = c("constant", "aggregate", "identity"), class = "factor"), class = c("sf", "tbl_df", "tbl", "data.frame"))), .y = 1L, .f = function (...) {    {        ...furrr_chunk_seeds_i <- ...furrr_chunk_seeds_env[["i"]]        ...furrr_chunk_seeds_env[["i"]] <- ...furrr_chunk_seeds_i +             1L        assign(x = ".Random.seed", value = ...furrr_chunk_seeds[[...furrr_chunk_seeds_i]],             envir = globalenv(), inherits = FALSE)    }    NULL    ...furrr_out <- ...furrr_fn(...)    NULL}):  In index: 1.
#> Caused by error in `match.arg()`:
#> ! 'arg' should be one of “vector”, “raster”

aoi
#> Error: object 'aoi' not found
# }