On Wed, 26 Nov 2003 [EMAIL PROTECTED] wrote:

> Hi, 
> Has anyone got any R code (or are there any packages) that calculates
> the great circle distance between two geographical (lat, lon) positions?
> 

Yes, there is R code in fields, function rdist.earth() taking vectors as
arguments for one solution, alternatively there is a C function in spdep:

void gcdist(double *lon1, double *lon2, double *lat1, double *lat2, 
                double *dist)

which needs to be put in a loop, but is specifically WGS84, and is based 
on the implementation at:

http://home.att.net/~srschmitt/greatcircle.html

There may be other code too.

Roger

> 
> Cheers 
> 
> Toby Patterson 
> Pelagic Ecosystems Research Group
> CSIRO Marine Research 
> Email: [EMAIL PROTECTED]
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to