1
我已經嘗試使用this question的響應來解決這個問題,但由於我在全球範圍內分佈有許多座標,所以我無法將其應用於我的案例。從多個GPS座標計算到最近岸的距離
有沒有人有辦法計算使用循環從一系列點到最近岸的最小距離(km)?這是點的子集,我使用(DATA HERE)
#setwd and load directories----
setwd("your_wd")
require (ggplot2)
require (ggmap)
#build a map to plot distribution of sample sites ----
sites<-read.csv("sites.csv", header=T)
#Using GGPLOT, plot the Base World Map
mp <- NULL
mapWorld <- borders("world", colour="gray50", fill="gray50") # create a layer of borders
mp <- ggplot() + mapWorld
#Now Layer the sites on top
Lon<-sites$x
Lat<-sites$y
mp <- mp+ geom_point(aes(x=Lon, y=Lat),color="blue", size=3)
mp
是的,我試過這個,但它選擇了一個問題的投影。對於點和多邊形,默認值爲WGS84,但Im得到的距離非常奇怪。 –