如何循环遍历文件夹中的多个栅格并使用点 shapefile 提取值
How to loop through many rasters in a folder and extract values using a point shapefile
如何遍历文件夹中的所有栅格 (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.
如何遍历文件夹中的所有栅格 (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.