Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要使用 R 获取一个点的距离(例如 10 公里)内的单元格编号,但我没有弄清楚如何处理栅格数据。
library(raster) r <- raster(ncols=10, nrows=10) cellFromXY(r, c(2,2)) # get the cell number of one point
如何获取一个点距离内的单元格数?
将 extract 与 buffer 选项和 cellnumbers=TRUE 一起使用
r <- raster(ncols=100, nrows=100) r[]<-runif(ncell(r)) xy <- cbind(-50, seq(-80, 80, by=20)) extract(r, xy[1:3,], buffer=1000000,cellnumbers=TRUE)