[R] Geographic distance between lat-long points in R?

dirknbr dirknbr at gmail.com
Mon Apr 11 17:44:22 CEST 2011

I found something here

#The following program computes the distance on the surface of the earth
between two points point1 and point2. Both the points are of the form
(Longitude, Latitude)
geodetic.distance <- function(point1, point2)
R <- 6371
p1rad <- point1 * pi/180
p2rad <- point2 * pi/180
d <-
d <- acos(d)


View this message in context: http://r.789695.n4.nabble.com/Geographic-distance-between-lat-long-points-in-R-tp3442338p3442355.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list