Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Latitude, Longitude and distances


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Latitude, Longitude and distances
Date   Wed, 30 Aug 2006 13:55:21 -0400

Dear "MA V" --
I think your preferred method of storing distance between 30 locations
depends on what you need to do with that info later, but it's easy to
think that you might want 870 observations with location_id1,
location_id2, and the distance between those two (or 435 obs where the
identity of 1 and 2 is unimportant, only that each pair is included).
Assuming you can put your data is a shape like this:
id1 id2 lat1 lon1 lat2 lon2
you can use the vincenty program like so:
vincenty lat1 lon1 lat2 lon2, g(d1) h(d2)
to generate distance variables.

Don't have the vincenty program?  Here it is:
net from http://www-personal.umich.edu/~nicholsa/stata
net install vincenty
No help file or warranty supplied, but references available on typing
which vincenty

On 8/30/06, Feiveson, Alan H. (JSC-SK311) <alan.h.feiveson@nasa.gov> wrote:
Here's a nice website that discusses this problem.

http://www.mathforum.com/library/drmath/view/51711.html

Al Feiveson

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of MA V
Sent: Wednesday, August 30, 2006 12:06 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: Latitude, Longitude and distances

Dear statalist users,
My problem is the following:
(and I am sending it again to the statlist since the follow-ups to my
initial email were not follow-ups to my question) I have a dataset that
has 3 variables: location_id, latitude, longitude.
I would like to calculate the distances between the locations but I'm
not sure of what is the best way of storing this information in Stata.
Suppose we have 30 locations (i.e. 30 observations).
Any ideas on how to to calculate the distances and, more importantly, on
how to store them (in an effective way, for future manipulation)?
Thanks for your help!

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index