extract_biome: Extract biome

View source: R/utils-biome.R

extract_biomeR Documentation

Extract biome

Description

Extracts biome for a point (latitude, longitude) based on the map with Potential Natural Vegetation (PNV) created by Hengl et al., 2018.

Usage

extract_biome(.data, ...)

## S3 method for class 'tbl_df'
extract_biome(
  .data,
  ...,
  reference = smpds::PNV_1km,
  buffer = 12000,
  all = FALSE
)

## S3 method for class 'sf'
extract_biome(
  .data,
  ...,
  reference = smpds::PNV_1km,
  buffer = 12000,
  all = FALSE
)

parallel_extract_biome(
  .data,
  reference = smpds::PNV_1km,
  buffer = 12000,
  cpus = 2,
  all = FALSE
)

Arguments

.data

Table containing columns for latitude and longitude (tibble object) or table with a geometry column (sf object).

...

Arguments passed on to extract_biome.tbl_df

reference

Reference map with biomes, default: smpds::PNV_1km.

buffer

numeric. The radius of a buffer around each point from which to extract cell values. If the distance between the sampling point and the center of a cell is less than or equal to the buffer, the cell is included. The buffer can be specified as a single value, or as a vector of the length of the number of points. If the data are not projected (latitude/longitude), the unit should be meters. Otherwise it should be in map-units (typically also meters).

all

Boolean flag to indicate whether or not to return all the detected biomes, default: FALSE (dominant biome only).

cpus

Number of CPUs to be used in parallel, default = 2.

Value

Table with the original data and matched biome(s):

  • if all = FALSE (default): Only returns the dominant biome: ID_BIOME

  • if all = TRUE: Returns all the detected biome - ID_BIOME and px, the number of pixels detected for each biome.

See Also

Other utils biome: biome_name(), plot_biome()

Examples

`%>%` <- magrittr::`%>%`
data <- tibble::tibble(entity_name = "University of Reading",
                        latitude = 51.44140,
                        longitude = -0.9418)
data %>%
  extract_biome()

special-uor/smpds documentation built on July 9, 2024, 5:39 p.m.