October 16, 2005

Flex and Google Maps Integration

I'm currently involved with a project where Google Maps needs to be integrated with Flex. While this souds like a trivial task if you're familiar with both technologies you'll know that they don't play nicely with each other.

What we recently concluded is that we should port Google's API to Flex so that the functionality could live entirely in Flex. After doing a good amount of research and reverse engineering this weekend I've come to the conclusion that this is a rather complicated task. It's not necessarily the code that's the problem, but getting an understanding of how Google handles converting lat/lons and linking them to tiles. Google's maps are tiled and some sort of algorithm is used to get the default tile based on location and build the map around it. There are all sorts of blog posts discussing how this was accomplished with older versions of the API. The problem is that several versions later Google has taken a different approach.

While I'm not completing giving up I'm going to research a different approach that consists of using a transparent background in Flash. This will allow the map div layer to show through as though it were actually inside the Flash content. The layer can be hidden and shown as necessary. You can see an example of it here:

http://www.db75.com/dev/gmaps/flex_gmaps.htm

This hasn't been thoroughly tested and I'm currently going through the cycles of testing a few things. Yet if this does work without any major issues this means we can leverage the Google API and not have to spend a lot of time rewriting in Flex. I'll continue to post any future findings here.

Posted by dennis baldwin at October 16, 2005 10:06 PM
Comments