【发布时间】:2018-08-25 11:54:25
【问题描述】:
首先,我是编程新手,所以这可能是一个简单的问题,但我无法在任何地方找到解决方案。
我一直在使用此代码从一组堆叠栅格中提取值:
raster.files <- list.files()
raster.list <- list()
raster.files <-list.files(".",pattern ="asc")
for(i in 1: length(raster.files)){
raster.list[i] <- raster(raster.files[i])}
stacking <- stack(raster.list)
coord <- read.csv2("...")
extract.data <- extract(stacking,coord,method="simple")
到目前为止,我已经多次使用此代码没有任何问题。每次我运行提取行时,都会出现此错误:
Error in .doCellFromXY(object@ncols, object@nrows, object@extent@xmin, :
Not compatible with requested type: [type=character; target=double].
坐标文件包含在具有 2 列(分别为 X 和 Y)的 data.frame 中。
【问题讨论】:
标签: r coordinates raster