[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: Latitude, Longitude and distances
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
On 8/30/06, Feiveson, Alan H. (JSC-SK311) <email@example.com> wrote:
Here's a nice website that discusses this problem.
[mailto:firstname.lastname@example.org] On Behalf Of MA V
Sent: Wednesday, August 30, 2006 12:06 PM
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: