Wednesday, May 06, 2009

Gotcha Of The Day: Finding A Reliable Source For Geo Calculations

Today, I spent a good chunk of time working on geo math - that is, math related to latitude, longitude and other details having to do with mapping. I found this tricky, to say the least.

My knowledge of (basic? advanced?) geometry is just too rusty to make sense of the formulas on Wikipedia and mountains of Perl code didn't help either, as the library I was working with didn't give me expected answers.

Finally, I came across this handy blog post. It outlines all sorts of handy Earth calculations, such as: distance between points, bearing calculation and destination given a location and bearing.

Best of all, the code is presented in concise JavaScript and even Excel formuals. There are working examples, which make the page even more useful. Finally, I found it handy to be able to read the source code of the working JavaScript directly to see how the code works.

If you're doing Geo Math, this is definitely a page you'll want to spend some time on.

Frankly, I've had enough cos and sin functions for today, thank you very much.

2 comments:

  1. welcome to my world... I think my group has this same code in many a version in many a language... Lets see, we have it in C, Java, Python, PHP, Fortran... basically every language we've used, but then again, geography is important when dealing with storms. That said, thanks for the link... it is always nice to have a second reference.

    ReplyDelete
  2. Now I know who to turn to when I have a geo math question...hmmm..this is good to know :-)

    -Ben

    ReplyDelete