【发布时间】:2013-06-29 11:34:16
【问题描述】:
我需要在世界地图中可视化一些地理数据。我已经了解了流动数据的great circle mapping tutorial,结果似乎很奇怪。是这样的:
显然我需要避免这些交叉的图片线。但我该怎么做呢?绘制地图的代码是这样的:
map("world", col="#f2f2f2", fill=TRUE, bg="white",lwd=0.05)
for (j in 1:length(location$lon)) {
inter <- gcIntermediate(c(lon_nj, lat_nj), c(location$lon[j], location$lat[j]), n=100, addStartEnd=TRUE)
lines(inter, col="black", lwd=0.8)
}
而且我已经试过gpe提供的代码Automating great-circle map production in R
map("world", col="#f2f2f2", fill=TRUE, bg="white",lwd=0.05)
for (j in 1:length(location$lon)) {
inter <- clean.Inter(c(lon_nj, lat_nj), c(location$lon[j], location$lat[j]),n=100, addStartEnd=TRUE)
lines(inter, col="black", lwd=0.8)
}
结果是这样的:
而我只想用最短的距离到达需要的地方。
而来自网络的答案,比如使用像 greatCircle() 这样的另一个函数也未能实现我的目标。
那么有人知道如何实现这个目的吗?
非常感谢!!
【问题讨论】:
-
gcIntermediate 有一个 breakAtDateLine 参数