October 28, 2016
Hot Topics:

The Google Maps API's Top 10 Under-the-Radar Enhancements

  • March 19, 2010
  • By Jason Gilmore
  • Send Email »
  • More Articles »

6. Add Traffic to Your Map

One relatively unknown feature of the Google Maps web site is the ability to view realtime traffic information, as depicted in Figure 6.

If you'd like to include a traffic-oriented feature within your application, you can draw upon Google's trove of traffic-related data by adding a custom traffic overlay made available through the API, as demonstrated here:

  var trafficOptions = {incidents:true};
  trafficInfo = new GTrafficOverlay(trafficOptions);

7. Add a Context Menu Control

The official Google Maps web site regularly adds interesting new features to the site, including most recently the ability to drop a marker identifying a location's coordinates, as demonstrated in Figure 7.

Adding the marker is done via a context menu, which is similar to the application-specific menu that appears when you right click at item on your computer's operating system. You can add a context menu to your Google Maps API-enabled web applications. The context menu contains several useful features, such as the ability to center the map over the menu location. An example of this context menu is presented in Figure 8.

Such a capability comes thanks to the GMaps Utility Library's Context Menu Control. Adding the context menu control is easy; you use just one line of code:

 map.addControl(new ContextMenuControl());

8. Use the Code Playground

Building applications using the Google Maps API is often involves much trial and error. Consider using the Google Code Playground to experiment with new features! This tool allows you to build maps using an amazingly simple point-and-click interface, in addition to providing you with an intuitive way to learn about how to implement some of the API's more difficult features, such as creating custom marker icons.

To begin creating your map, just select the map feature from the list as depicted in Figure 9. The utility will add the feature to the code editor and automatically update a map located below these widgets.

9. Build Custom Applications Using the Google Maps Data API

Given the mind-boggling amount of data stored within Google's mapping service, it's clear that they've devoted a great deal of time to designing a scalable, reliable storage and access solution. If you'd like to leverage not only their cataloged data but the actual data storage system used by the service to create your own custom mapping application, check out the Google Maps Data API. By accessing the raw data in KML format, you can create geo-applications for mobile devices, desktop applications, or even command-line interfaces!

10. Embed Google Street View

Google's Street View project has received a great deal of press, both positive and negative. Regardless of your feelings about the project's implications, the techie in you has to admit that it's pretty darned cool. If you'd like to integrate Street View into your mapping applications, check out the API's Street View capabilities. Not only can you add a Street View overlay such as that found on the official Google Maps web site, but you also can implement advanced features such as integrating user photos found within photo services such as Google Picasa.

The StreetViewPanorama object is Flash-based, meaning it will work only on client devices that support Flash. Sorry iPod and iPhone users!


Almost five years after its initial release, the Google Maps API remains a model of innovation, as indicated by the 10 great features discussed in this article. Are you using new or interesting API features within your applications? Tell me about them in the comments!

About the Author

Jason Gilmore is founder of EasyPHPWebsites.com. He is the author of several popular books, including "Easy PHP Websites with the Zend Framework," "Easy PayPal with PHP," and "Beginning PHP and MySQL, Third Edition."

Tags: JavaScript, Google Maps, local search, mobile development, localization

Page 2 of 2

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel