Thanks very much for the help!
Scott On Monday, April 11, 2011 at 12:54 PM, seeliger.c...@epamail.epa.gov wrote: > I have a bunch of geographic locations specified by lat-long > > coordinates. What's an easy way to calculate geographic distance > > between any two points? OR, perhaps there is a function for > > calculating a distance matrix for K sites? > > A comparison of some geographic distance calculations is provided at > http://pineda-krch.com/2010/11/23/great-circle-distance-calculations-in-r/ > , along with code for calculating the Vincenty inverse formula, which > relies on the WGS-84 ellipsoid approximations. > > The author compares the results to fields::rdist.earth, which seems to > rely on a spherical model of the earth. It would be interesting to > compare it to other distance functions as well. > > I found that the function provided at the above URL did not handle the > case of coincident points. Adding the following line after the while loop > fixed this. > if (iterLimit==100) return(0) # formula began with nearly or > exactly coincident points > > Enjoy the days, > cur > -- > Curt Seeliger, Data Ranger > Raytheon Information Services - Contractor to ORD > seeliger.c...@epa.gov > 541/754-4638 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.