如何遍历文件夹中的多个栅格并使用点shapefile提取值

时间:2016-03-01 20:49:10

标签: r raster

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

1 个答案:

答案 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.