简体   繁体   English

围绕坐标创建圆形区域

[英]Create circular areas around a coordinate

I need to create circular areas around a coordinate to identify points inside this circular area.我需要围绕坐标创建圆形区域以识别该圆形区域内的点。 Any ideas how can I do this the easiest way in R?任何想法如何在 R 中以最简单的方式做到这一点?

You can do this with the sf package.您可以使用 sf package 做到这一点。 Will need to bring in your data, this differs if you have a spatail data file, or are getting your data from tables.需要引入你的数据,如果你有一个 spatail 数据文件,或者从表中获取数据,这会有所不同。 Then buffer your co-ordinate to get your circular polygon, then intersect that against your points ot get only those that overlap.然后缓冲你的坐标以获得你的圆形多边形,然后将它与你的点相交,而不是只得到那些重叠的点。

library(sf)
library(tidyverse)

##if from table data###
CO_ORD <- st_as_sf(x =  "co-ord-data-file.csv", coords=c("Long", "Lat"))

POINTS <- st_as_sf(x = "points-data-file.csv", coords=c("Long", "Lat"))


###if from spatail data file####

CO_ORD <- st_read(dsn="co-ord-spatial-data.gdb", layer="co-ord-layer")

POINTS <- st_read(dsn="poins-spatial-data.gdb", layer="points-layer")



CO_ORD_BUFF <- st_buffer(x = CO_ORD, dist=500)

OVERLAPPING_POINTS <- st_intersection(POINTS, CO_ORD_BUFF)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM