Description Usage Arguments Value See Also Examples
View source: R/getSampleValues.R
Given a Raster* object and a SpatialPointsDataFrame object, the functions returns a SpatialPointsDataFrame objects with the values of the raster at sample points.
1 | getSampleValues(x, s, keepCols = FALSE, filename = "", ...)
|
x |
A Raster* object |
s |
Location of the sample points. Object of class |
keepCols |
Should the columns of |
filename |
Character. Output filename including path to directory. File will be automatically saved as an ESRI Shapefile and any extension in |
... |
Additional arguments passed to |
SpatialPointsDataFrame object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Load raster package
library(raster)
# Open and stack ALS metrics
elev_p95 <- raster(system.file("extdata/examples/ALS_metrics_p95.tif",package="foster"))
cover <- raster(system.file("extdata/examples/ALS_metrics_cov_mean.tif",package="foster"))
Y_vars <- stack(elev_p95,cover)
names(Y_vars) <- c("p95","cover")
# sample_points is a SpatialPointsDataFrame calculated and saved from getSample
# Load it into memory
load(system.file("extdata/examples/sample_points.RData",package="foster"))
getSampleValues(Y_vars, sample_points)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.