World Distance Calculators – which came first?

So I get this email from some nice person at the University of Cape Town, South Africa – appearently another Dean Peters with a similar gmail addresss submitted a resume for a tutoring position.

Wanting to soften the blow of the now disappointed teacher once eager to the real (and published) Dean Peters, I decided to offer up some humor about how the ‘D’ mile commute may be a bit to costly. However to pull this off, I needed to calculate the value of ‘D’ — the distance between Cary, N.C., USA and Cape Town, ZA.

After a somewhat frustrating Google search for non-U.S.-centric calculators (ahem) I managed to find one entitled “Flying distances between 325 major airports in the World” which renderd a distance of 7957 miles (12806 km). I also noticed that a ‘calculator’ page also had a prompt above the form that read … in fire engine red … “Estimated flying time in hours: Flying distance in Kilometers divided by 750.” This was followed with a link to a Javascript calculator page, without the benefit of filling in the blanks for me — immediately making me wonder, why didn’t the programmer just add these features to the existing page?

View Source
So I looked at the underlying Javascript, which was preceeded with a meta tag where the name attribute = ‘author’ and the content attribute = ‘Mr.Ad Latjes, President of ETN.’

This inspired me to look on the Calculators page at the Javascript Source website. While I did find a better coded example of an airport to airport calculator, it was for U.S. cities only.

I kept Googling various combinations of ‘javascript, distances, airports’ until I came across this 1997, USDA sponsored gem entitled “Surface distance between points of Latitude and Longitude.”

Now I’m not going to speculate which came first, nor who ‘borrowed’ from whom, though I must say I’m amazed at the similarities between the two. In fact, when I saved-off the code between the <script/> tags, then ran a UnxUtil named diff, I found the only difference occured at lines 466 where one version rounded off the results using the Math.floor method, and the other didn’t. Fancy that!

Point Is
So what’s the point, besides not being able to sleep because of the stress of my new job? With some work, I think the ‘global’ script in question could be easily expanded to include the simple calculation of (km / 750) to also provide the user with estimated time between the distances.

In other words, a good tenet of ‘Defensive Design‘ is: when possible, automatically calculate values for the users instead of making them do it for themselves, e.g. 17.05 (let the reader understand).

Especially when said user is busy trying to calculate the time and distances traveled for a summer mission trip. No, I’m not going to South Africa … though I wouldn’t mind — but I figued some of you other good folks out there may be planning a trip abroad and could use the info.