Thursday, August 06, 2009

Dead easy google maps integration

Several months ago I had to plot data on a map. It didn't need to be very fancy, it was a low budget project and they just needed to see between 100-5000 data points on a map. After looking around it seemed to me that the easiest way of plotting the data was to just generate a georss document and send the user to a google maps url that would load the rss document.

RSS is most commonly used for keeping track of blog updates, but that doesn't mean that's the only thing you can use it for. Nothing says that the data in the RSS feed has to be time oriented or even changing. My application generates the RSS document from the database, so it could change from time to time, but on the whole it shows the same items all the time. It actually doesn't even have a date in the document.

My application just created a url that the user could visit to view the RSS for the needed data and then redirected them to google maps with the RSS feed url as a query option:
Google maps downloads the RSS document and displays the items on the map. The xml is really easy to build. If you are just putting this data in RSS to get it to google maps (I did) then you'll have to build the RSS from scratch. It's still easy. Here is an example of some simple RSS markup that you can easily generate from what ever language you are using.

It took me 30min to roll out basic google maps integration with my data using this really easy method. You can read more about it at

No comments: