OneWheeledBicycle

Random mutterings of Alastair James

Dropping pins in google maps!

with 5 comments

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!

About these ads

Written by aljames

August 21, 2008 at 9:40 am

Posted in Coding, Google maps

5 Responses

Subscribe to comments with RSS.

  1. brilliant function. Got to make this available for everyone to use.

    very fun!

    Devin

    September 5, 2008 at 3:10 pm

  2. 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

  3. how can i drag the marker??

    wellinton

    March 13, 2009 at 12:10 pm

  4. where is the demo?

    Tim

    April 29, 2010 at 2:50 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: