获取一点距离内的单元格编号(栅格) [英] get cell number within a distance of one point (raster)

查看:87
本文介绍了获取一点距离内的单元格编号(栅格)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用R获得在一个点的距离(例如10 km)内的像元编号,但是我不知道如何处理栅格数据。

I need to get the cell numbers within a distance (e.g., 10 km) of one point using R, but I didn't figure out how to handle it for the raster data.

library(raster)
r <- raster(ncols=10, nrows=10)
cellFromXY(r, c(2,2)) # get the cell number of one point

如何获取1点以内的像元编号?

How to get the cell numbers within a distance of one point?

推荐答案

将提取与缓冲区选项一起使用,并且cellnumbers = TRUE

Use extract with the buffer option and 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)

这篇关于获取一点距离内的单元格编号(栅格)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆