Description Usage Arguments Value Examples
View source: R/extract_raster.R
This function allows you to extract the values of one or many rasters at the location of given points.
1 2 3 4 5 6 7 8 | rg_extract_raster(
rasters,
shp,
id.vars,
value.name = "value",
variable.name = "variable",
...
)
|
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'. |
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.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.