Description Usage Arguments Value Examples
View source: R/raster_extract.R
This is a wrapper around raster::extract
, to apply the function on stars
objects without needing to convert to and from a Raster*
object.
1 | raster_extract(x, y, fun = NULL, na.rm = FALSE)
|
x |
A |
y |
An |
fun |
A function to summarize raster values, default is |
na.rm |
If |
A vector, matrix
, or list
1 2 3 4 5 6 7 8 | library(stars)
tif = system.file("tif/L7_ETMs.tif", package = "stars")
r = read_stars(tif)
pol = st_sfc(st_buffer(st_point(c(293749.5, 9115745)), 400), crs = st_crs(r))
plot(r[,,,1], reset = FALSE)
plot(pol, add = TRUE, border = "red")
raster_extract(r, pol)
raster_extract(r, pol, fun = mean)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.