In working on improvements to our embedded Google Map, I found that I needed functionality on the server-side that Google provides as part of its javascript API (I'm looking at fromLatLngToPixel). The obvious answer is to port the javascript function to Python, but Google obfuscates its javascript. I decided to try unobfuscating their code to see if that was easier than learning trig. It turned out to be the right way to go, because the function as written requires constants specific to Google Maps that I would either have needed to compute myself, or to unobfuscate anyway. (BTW, these constants seem to indicate that Google thinks it will have 31 zoom levels some day. They currently only use up to level 19 [0-indexed]. Level 30 is going to be really hi-res!)
Now in fact, unobfuscating one function wasn't that hard. First, I copied two of Google's scripts to my server. You need the first one they have you link to, and also the script that the first one loads (this is the one in the upper-right box on Mapki). Using my text editor, I added line breaks to both after semicolons and end-braces. The first script isn't actually obfuscated, just minified, and it's not that long, so I actually went on to format the whole thing. Once I could read the first script, I only had to make two changes to it in order for both scripts to work from my server: I had to tweak the call to the second script from the first so it pointed to my version (in GLoadMapsScript at the bottom), and I had to comment out the key validation check (in GLoad). Then I linked to my version of the first script from my HTML page, and it worked like normal! Blam.
With Google's scripts under the reigns, Firebug's debugger made it trivial to isolate the function I wanted. I triggered a call to the function in a third script, and placed Firebug's special debugger keyword before the function call. That gave me a runtime debugger with which to simply step into Google's function. And with the script on my own server, I could then isolate the function in my text editor, format it, and poke it until it made sense. And once it made sense, it was a simple matter to translate it to Python.
Now, mind you, I'm not opposed to learning trig. But when the exact function I need is already written, I'll definitely try a little hackery if it can save me some effort. And the effort I saved, I've spent on this blog post. So there. You win.
P.S. As far as I can tell I'm not violating the terms of service. Please tell me if I am. I am not a lawyer.
UPDATE: Actually, this is really bad form, isn't it? Google has not at all given me the right to port their obfuscated JavaScript to Python. I'm sorry. I've removed the Python script linked above. Should I take down this whole post?