English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a zip code database that includes latitude and longitude. Can anyone help me the formula that count the distance between two zip codes?

2007-01-20 15:03:33 · 4 answers · asked by Anonymous in Science & Mathematics Geography

4 answers

cos(D) = { [ sin(p) * sin(a) ] + [ cos(p) * cos(a) * cos(g) ] }

where D is the distance between the two points in degrees,
p is the latitude of point 1
a is the lstitude of point 2
g is the absolute value of the difference in longitude between points 1 and two
and
distance = D* 69 ( in miles)
see reference for a more accurate calc.

none of these will account for changes in elevation above sea level and are abviously "as the crow flies", not on the surface.

2007-01-20 16:26:04 · answer #1 · answered by Anonymous · 0 1

The miles per degree at the equator is 69 miles in both latitude and longitude. Latitude degrees stay the same size to the north pole, so one side of the triangle for distance is the difference in degrees N (since zip codes are all in the USA, they will all be N)
The miles per degree EW get smaller the further north, so it is necessary to get the difference in degrees EW, then multiply by 69 then multiply by the cosine of the latitude to reduce the miles for reduced degree size.
Then you have two sides of the triangle. If the distance is not too great, you can simply use Pythagoras's Formula where a^2= b^2 +c^2 to get the hypotenuse from the two sides. If the distance is over a couple of hundred miles (not sure how big) you will have to use a formula for spherical triangles which we leave as an exercise for the student (because we don't know how to do it, except it will always be bigger than the flat triangle.)

2007-01-20 15:28:25 · answer #2 · answered by Mike1942f 7 · 0 0

I don't think the US Postal Service is smart enough to come up with a "formula" for zip codes, although the numbers do get higher from east to west coast

2007-01-20 16:43:15 · answer #3 · answered by Anonymous · 0 0

Zip code distributions are not based on distance, but on population density, so there is no way to establish a formula for such a thing. This web site is pretty neat, and you can see right off what I am talking about.
http://acg.media.mit.edu/people/fry/zipdecode/

2007-01-20 15:45:15 · answer #4 · answered by David W 3 · 0 1

fedest.com, questions and answers