在R中的缓冲区内提取点ID

问题描述

我有一个具有纬度/经度坐标和ID的文件。我试图在每个点周围创建一个1km的缓冲区,然后获取每个缓冲区内所有点的ID。我不能做后者。这是我到目前为止所拥有的:

library(maps)       
library(mapdata)
library(sp)
library(raster)

map('world2Hires',"Canada")

Geocoded_Data <- read.csv("filepath/Geocoded_Data.csv",header = TRUE)

# Lay the points over the map:
points(Geocoded_Data$long,Geocoded_Data$lat,col = "red",cex = .1)

# Remove NA values
Geocoded_Data <- Geocoded_Data[complete.cases(data),] 

# Make a spatial data frame of locations
coords<-data.frame(x = Geocoded_Data$long,y= Geocoded_Data$lat)
crs<-"+proj=longlat +datum=wgs84 +no_defs +ellps=wgs84 +towgs84=0,0"

neighborhood.spdf <- SpatialPointsDataFrame(coords=coords,data=Geocoded_Data,proj4string=CRS(crs))

# Create 1km buffer and plot **strong text**it
buffer_1km <- buffer(neighborhood.spdf,width=1000)
plot(buffer_1km,add=TRUE,col='light blue',border='light blue')

# How do I Now extract the IDs of the points inside each buffer?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)