R 如何循环遍历文件夹中的多个光栅并使用点形状文件提取值

R 如何循环遍历文件夹中的多个光栅并使用点形状文件提取值,r,raster,R,Raster,如何循环文件夹中的所有光栅(TIFF)并使用具有多个坐标的点形状文件提取值,然后将输出作为数据帧?库(光栅) library(raster) library(rgdal) files <- list.files(path=".", pattern="tif$", full.names=TRUE) # select all the tiff files in the directory s <- stack(files) # stack all of them using r ras

如何循环文件夹中的所有光栅(TIFF)并使用具有多个坐标的点形状文件提取值,然后将输出作为数据帧?

库(光栅)
library(raster)
library(rgdal)

files <- list.files(path=".", pattern="tif$", full.names=TRUE) # select all the tiff files in the directory
s <- stack(files) # stack all of them using r raster library
shp <- shapefile("points.shp") # read the point shape file
ext <- extract(s, shp) # extract the values from raster stack.
图书馆(rgdal)
文件@RobertH我不想堆叠层,我需要循环遍历每个层,并使用点形状文件提取值。@jmutua使用for循环不会得到不同的结果。您可以使用:
mylist@Geo sp-这不一定是真的。假设光栅都具有相同的范围和分辨率(即它们是可堆叠的)@jmutua,那么您应该能够使用上面的for循环。