extract.raster: Extracting values from raster(s) at point locations

Description Usage Arguments Value Examples

View source: R/extract_raster.R

Description

This function allows you to extract the values of one or many rasters at the location of given points.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'raster'
extract(
  rasters,
  shp,
  id.vars,
  value.name = "value",
  variable.name = "variable",
  ...
)

Arguments

rasters

An object of class RasterLayer, RasterStack or RasterBrick. Can also be a path to a raster file or multiple paths. In the last case the corresponding files will be opened in a stack.

shp

A SpatialPointsDataFrame with the location of the points where the values should be extracted.

id.vars

A vector with the column names of 'shp' that should be in the resulting data.frame

value.name

Name of the column that stores the extracted values. Defaults to 'value'.

variable.name

Nae of the column that stores the names of the input rasters. Defaults to 'variable'.

Value

A data.frame with the first column corresponding to the first column in 'shp' and two columns that contain the names of the given rasters and the extracted values, respectively.

Examples

1
2
3
4
5
extract.raster(rasters = data/dem_st.tif,
  shp = station_sp,
  id.vars = c('st_id', 'st_group'),
  value.name = value
  variable.name = variable)

sitscholl/rebecka_package documentation built on Aug. 25, 2020, 4:20 a.m.