ExtMapTypeControl 1.1: A Smarter Traffic Button

Wednesday, August 08, 2007 at 10:33:00 AM

In June, we released ExtMapTypeControl, an open-source map type control that includes an optional "Traffic" button. Some developers were disappointed that the traffic button did not hide and show depending on whether traffic was available in the current viewport, as the button in maps.google.com does.

In this week's release of API v2.86, there is a "changed" event for GTrafficOverlay that sends a boolean indicating whether traffic data is available in the current viewport. Using this event, I've modified the traffic button in ExtMapTypeControl to behave exactly as the maps.google.com button does. The example below lets you test out the new behavior - pan and zoom out to the other side of the world to see the button disappear.

You can grab the new code from the 1.1/src folder, or wait two weeks for the new code to be pushed into the release directory. This code is also a great starting ground for people looking to make a customized map type control for their sites - here's an example of customizing it for a fake merchant called "The Blue Store". You could also customize it for green, red, or even purple stores. :)