1
R(栅格包)中的gridDistance函数生成具有给定值的单元格的距离图。该功能以当前投影为单位给出距离,如果使用LatLong,则以米为单位。我想知道是否使用LatLong的距离是“纠正”(大地测量)。否则,我可能需要重新投影到等距投影。 感谢在LatLong中工作时,gridDistance是否计算大地测量距离? (R中的栅格包)
R(栅格包)中的gridDistance函数生成具有给定值的单元格的距离图。该功能以当前投影为单位给出距离,如果使用LatLong,则以米为单位。我想知道是否使用LatLong的距离是“纠正”(大地测量)。否则,我可能需要重新投影到等距投影。 感谢在LatLong中工作时,gridDistance是否计算大地测量距离? (R中的栅格包)
展望真正优秀的raster
包,它看起来像你的直觉是正确的源...
# From gridDistance() when lonlat is true
if (lonlat) {
distance <- pointDistance(
# From pointDistance()
if (! longlat) {
return(.planedist(p1[,1], p1[,2], p2[,1], p2[,2]))
} else {
return(.haversine(p1[,1], p1[,2], p2[,1], p2[,2], r=6378137))
}
# Finally from .haversine()
.haversine <- function(x1, y1, x2, y2, r=6378137) {
adj <- pi/180
x1 <- x1 * adj
y1 <- y1 * adj
x2 <- x2 * adj
y2 <- y2 * adj
x <- sqrt((cos(y2) * sin(x1-x2))^2 + (cos(y1) * sin(y2) - sin(y1) * cos(y2) * cos(x1-x2))^2)
y <- sin(y1) * sin(y2) + cos(y1) * cos(y2) * cos(x1-x2)
return (r * atan2(x, y))
}
因此,在短期,是的,你得到超级准确的测量距离。
好!谢谢! – Oritteropus 2013-03-26 19:57:54