Great Circle Distance

A few weeks ago I was working on a project that included a store locator. It required the user to input his/her zip code. Then the site would return a list of stores in order of their proximity to the user’s zip code.

I have to admit that I’ve seen this functionality on a variety of sites but I was never sure how the distances were calculated. As I began reading the source code, I learned that the previous programmer was using spherical geometry. That is after reading a few of the comments he included and then making a trek to Wikipedia. I came across an article on Great Circle Distance. Because of the curve of the earth you can’t just use linear geometry.

To say I was stymied was an understatement. I took geometry in high school and trigonometry in college but this beyond what I had ever attempted. After a few minutes of confusion, I got a clearer picture. I understood that I was taking various angles and distances and running a multitude of calculations. My biggest problem at first was that I wanted to actually figure out the cosine or tangent of each angle. I finally reached the point where I understood that to make this work I didn’t have to understand the inner workings I just needed to plug in the right pieces in the right places. Once I began breaking down the equation by its orders of operation it made more sense. I coded the whole equation and it calculated the same distance as Google on the first try.

Granted, I didn’t learn spherical geometry in high school but it is similar to the type of things I would have lamented over, “I’ll never use this in the real world.” This got me to thinking. What other things that I learned in school have I used in “real life.”

  • Spanish - I didn’t learn Spanish until college but I’ll include it. I’ve been to Mexico several times and it was a definite advantage. I also used it from time to tome while working at Pizza Hut. There were times when I had to converse with customers in Spanish. I would also eavesdrop on my hispanic coworkers who forgot that I could speak Spanish.

  • French - Not so much. I wish I had remembered more for the time I went to Paris and Benin.

  • American Civics - I understand how our government is supposed to work. As I have grown older, the current state of our political system just depresses me.

  • Free Enterprise - I used the subject matter of this class during my brief entrepreneurial period. There was not enough demand for my supply, hence I went out of business.

  • Keyboarding - We used actual typewriters in this class. I am so thankful for that class. I spend most of my day in front of a computer, so I revel in the fact that I don’t have to hunt and peck.

  • Chemistry - I love watching the chemical reaction of Mentos reacting with Diet Coke. If we could have done that experiment in high school, then chemistry would have been a great deal more enjoyable.

  • History - “A person who fails to understand history is destined to repeat it.” I didn’t learn that in my history classes. I think I heard it in a movie somewhere. Most of the time, I use my knowledge in history to point out people’s historical inaccuracies. It’s a bad habit, I know.

  • Consumer Math - This is the class where you learned to balance a check book and calculate interest on a mortgage. That was an easy A.

  • English Literature - “From this day to the ending of the world, But we in it shall be remember’d; We few, we happy few, we band of brothers; For he to-day that sheds his blood with me Shall be my brother; be he ne’er so vile, This day shall gentle his condition: And gentlemen in England now a-bed Shall think themselves accursed they were not here, And hold their manhoods cheap whiles any speaks That fought with us upon Saint Crispin’s day.” Who hasn’t wanted to quote those lines from Henry V in a conversation to embolden their troops. Sadly, the opportunity has evaded me to this point.

  • Physics - I didn’t take Physics in high school or college. However, after watching Mythbusters, I would really like to learn. Who doesn’t want to know how much kinetic energy is released when a car collides with the ground after being thrown by a trebuchet. Thanks to UC Berkeley, I can now take the equivalent of Physics for Dummies.

Well, it’s not an exhaustive list, but I think my high school years were well spent. But as the old saying goes, “You’re never done learning.”