merge_area: Merge rasters over a gridded study area.

View source: R/merge_area.R

merge_areaR Documentation

Merge rasters over a gridded study area.

Description

Merge rasters over a gridded study area.

Usage

merge_area(
  an_area = NULL,
  to_merge_area = NULL,
  var_names = NULL,
  new_name = NULL,
  dir_path = NULL
)

Arguments

an_area

A SDM_area object with cells covering the study area.

to_merge_area

A path to a Raster* (https://cran.r-project.org/web/packages/raster/) object (folder or file) with variables to merge with.

var_names

A list of variable names to keep on cells. It try to match each variable name (ignoring case and partially matched) in the study area. Variables are calculated using the average of features (polygons or lines) coverage by each cell.

new_name

A name to new area study after merge rasters over area. the average of features (polygons or lines) coverage by each cell.

Value

A SDM_area object containing variables merged with. If the CRS of the Raster* is different from the CRS of the SDM_area object, it is reproject. The merging process produces cells intersecting SDM_area object and Raster*.

Examples

## Not run: 
SPDF <- readOGR(
   system.file("vect_files/brasil_uf.gpkg", package="sdmTools"),
   layer = "brasil_uf",
   verbose = F
)

gridded_area <- SPDF %>%
 sdm_area("Test area", "EPSG:6933", c(50000, 50000)) %>%
 make_grid(var_names = list(), new_name = T)

gridded_area <- gridded_area %>%
   merge_area(
      system.file("rast_files", package="sdmTools"),
      var_names = list("bio_5m_01", "bio_5m_02")
   )

gridded_area$study_area@data %>% head()

## End(Not run)


reginaldo-re/sdmTools documentation built on April 25, 2022, 8:08 p.m.