【发布时间】:2019-08-20 10:04:07
【问题描述】:
我有一个与此 SO 帖子非常相似的问题:
Geographic / geospatial distance between 2 lists of lat/lon points (coordinates)
这是一个经过编辑的坐标示例集,用于说明我的情况:
require(tidyverse)
list1 <- data.frame(longitude = c(72, 74, 76, 78, 79, 82),
latitude = c(20.5, 19, 19.5, 20, 22, 21),
area = "A")
list2 <- data.frame(longitude = c(71, 73, 75, 77, 79, 78.5, 72),
latitude = c(21.5, 22, 20.5, 23, 23.5, 24, 24),
area = "B")
df <- bind_rows(list1, list2)
ggplot(data = df) +
geom_point(aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list1, aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list1[c(2,6),], aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list1[c(1,4),], aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list2[c(1,7),], aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list2[c(7,6),], aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list2[c(6,5),], aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list2[c(5,3),], aes(x = longitude, y = latitude, color = area)) +
geom_line(data = list2[c(3,1),], aes(x = longitude, y = latitude, color = area))
所以我需要计算两个坐标点列表之间的最小距离。我已经能够完成这项工作,但我注意到我需要更高效的东西 - 数据太大了。
我想到的一种可能性是形成这些区域的非重叠多边形并计算一组点到相邻多边形的距离。有没有办法形成这些多边形?凸面外壳不是一种选择,因为这些区域非常粗糙。
另一种选择是在区域之间形成一条线。
编辑:我在图中添加了一些线条来说明多边形。
【问题讨论】:
-
你能和我们分享sample of your data吗?帮助你会更容易
-
我对地理空间主题不太熟悉,但也许你可以调整this answer 来计算最小距离,如果需要也可以使用不同的距离。
-
patL:我现在包含了一个带有一些虚假数据的小示例。
-
"是对这些区域形成不重叠的多边形,并计算一组点到相邻多边形的距离。" - 你能为你的测试数据画出你正在谈论的多边形吗? (也许使用绘画程序?)
标签: r geospatial