Is there a package which allows to compute the spatial distance between two points taking into account the elevation. So for each point, we would have latitude, longitude and elevation. So far, I had to write the following function:
library(geosphere)
distance3D <- function (point1, point2) {
planiDist <- distm(point1[1:2], point2[1:2])
altiDist <- point2[3] - point1[3]
dist3D <- sqrt(planiDist^2+altiDist^2)
return(dist3D)
}
I was just wondering if one function existed in one of the R packages.