Dropping pins in google maps!
I am a big fan of the google maps on the iphone. I particularly like the way that the little pins drop from above and bounce. I wanted to find a way to do this in the standard google maps, and after a little hacking, I have found a way. Sadly though, the technique detailed here works only with the current version of maps. This is because it interfaces directly with the compressed google code, where the function and variable names are randomised (obscured) with each version increase. Thus, to make this work you need to specify the current version number (2.123) in the map file include.
Anyway, to cut a long story short, I figured, that as you can make markers bounce after you drag them, it should be possible to make them bounce in other situations. I was looking for an function named ‘bounce’ or similar, but it was a bit harder than that! After tracing the flow through the obscured maps code (!) I found that you can drop a marker from above using the following code:
// Make bouncable
marker.Xa = true;
marker.Pa = height; // Current height
marker.ri = height; // Max height
marker.av = 1; // Direction (+ = down)
marker.tc(); // Go baby!
Here is a demo. The markers also ‘hop’ when you move the mouse over them. In the source code there are three functions, dropMarker, hilightMarker and dehilightMarker. Check them out!
Please, please, please google can we make a publicly available ‘bounce’ function?
Update: Sorry, the demo (http://www.worldreviewer.com/junk/iphone-map.html) seems to have stopped working. I think the API version that this worked on is too old and not supported anymore!