[R] Midpoint between coordinates

Mafalda Viana vianam at tcd.ie
Fri Jul 23 13:13:47 CEST 2010


Dear R users,

I need to find the coordinates for the point (midpoint) located half
way between two pairs of coordinates (lon1,lat1 and lon2,lat2)
assuming a straight line between them. What would be the best way? I
tried to find an answer in the help archives but without success. I
would greatly appreciate any help.

df<- data.frame(lon1=c(-4.568,-4.3980), lat1=c(59.235,56.369),
lon2=c(-5.123,-4.698), lat2=c(60.258,59.197) )

Thanking in advance,
Mafalda



More information about the R-help mailing list