如何遍历文件夹中的所有栅格(TIFF)并使用具有多个坐标的点形文件提取值,然后将输出作为数据帧?
答案 0 :(得分:3)
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.