Description Usage Arguments Value Author(s) References Examples
Great circle or geodesic distance.
1 | GCdistance(lat1,lon1,lat2,lon2)
|
lat1 |
Latitude of points of origin. |
lon1 |
Longitude of points of origin. |
lat2 |
Latitude of points of destination. |
lon2 |
Longitude of points of destination. |
Distance between origin and destination points in metres.
Javier G. Corripio
https://edwilliams.org/avform.htm,
http://mathworld.wolfram.com/GreatCircle.html.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | GCdistance(0,0,0,180)*2
# distance between the center of US states
data(state)
ddd = matrix(nrow=50,ncol=50,dimnames=list(state.name,state.name))
for (i in 1:50){
for (j in 1:50){
distij = GCdistance(state.center$y[i],state.center$x[i],
state.center$y[j],state.center$x[j])
# round to miles
ddd[i,j]=round(distij/1609.344,2)
}
}
# format and print results for the 10 firsts states
as.dist(ddd[1:10,1:10])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.