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
if (!marker.Xa)
{
marker.Xa = true;
marker.qo(false);
}
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!










brilliant function. Got to make this available for everyone to use.
very fun!
Devin
September 5, 2008 at 3:10 pm
Wow thanks a million for this! I am going to include it in my new iPhone app =)
Greg
January 19, 2009 at 10:32 pm
how can i drag the marker??
wellinton
March 13, 2009 at 12:10 pm
where is the demo?
Tim
April 29, 2010 at 2:50 pm
HI, Sorry, it seems to have stopped working (http://www.worldreviewer.com/junk/iphone-map.html). I think the API version I made this work with is no longer supported!
aljames
June 2, 2010 at 12:11 am