Skip to content

Placing 3D objects on a Google Flash Map

2008 September 4
by Sven Busse

Juten Tach,


today i suddenly felt the need of playing around with the Google Maps Flash API. I had the idea of placing 3D objects on a map and being able to move them along with moving the map itself.

For doing so, i chose Away3D.

I searched a little bit for an idea how to combine a 3D object with the map and i decided to use Markers from the Google Maps Flash API to do it.

The basic concept is: I create a marker, that uses a little Bitmap Object as an icon and i hold a reference to that icon. The bitmap content is irrelevant and has only one pixel. Since i use a normal Marker object, i can simply place the marker by using lattitude and longitude values.

Now i setup a 3d scene from away3d on top of my map and create 3d object. Note, i am the exact opposite of a 3d-expert, so in my example i am just using a primitive object for demonstration purposes.

Once this is done, i add a listener to the Map_Move event from the Google Maps Flash API and i request the coordinates of my little marker icon and recalculate them with the localToGlobal() method.

Now i simply set the 3d position of my primitive 3D object according to the position i got from above and that’s it.

You have to finetune the relative position of the Camera a bit, so that the movement of the object is in sync with the movement of the map.

Now i wanted to go a step further and place some object from Google Warehouse on my map, but apparently, this is not an easy task, since all the models i tried caused errors with Away3D.

Anyway, if you think, this might come in handy someday, you can download the source code here. Note, you need your own Google Maps API key for playing with that stuff.

You appear to be missing flash, which i cannot understand. You can install it here.

2 Responses leave one →
  1. German Bauer permalink
    September 8, 2008

    How about adding a subtle alpha drop shadow? That would make the illusion more believeable…

  2. September 9, 2008

    yeah, good idea, will try that.

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS

*