Calculating Great Circle Distances
I wrote a program to calculate the distance between two international cities, here take a look.
In order to get a list of avaliable cities comment out the line
print_r(distance($decimal[54],$decimal[170]));
and put
print_r($decimal);
this will list the avaliable cities in a format like
[326] => Array
(
[latitude] => 47.35
[longitude] => 8.5166666666667
[name] => Zurich, Switzerland
)
[325] => Array
(
[latitude] => -6.1666666666667
[longitude] => 39.333333333333
[name] => Zanzibar, Tanzania
)
so to calculate the distance between Zanzibar and Zurich do
print_r(distance($decimal[326],$decimal[325]));
download the script
this code downloads the data from some obscure page on the West Cotton Research Labratory and to a small extent was used as a model for the great circle formula
Why did I go through all this trouble? take a look back tommorow. can't wait? i'll give you a hint how can you go faster than the speed of sound without causing a sonic boom?
No Comments »
No comments yet.
RSS feed for comments on this post. TrackBack URI
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>