Hack 28. Get Access to the Google Maps API
Create applications that combine Google Maps and your own server components.
To use the API, you have to first obtain a developer's key from Google. This is very easy. Simply go to http://www.google.com/apis/maps/, specify the web site that will use Google Maps (such as http://www.parkerriver.com), and click on a form button, and Google generates a key for you. This is a long bunch of alphanumeric characters, such as:
All these objects except for GPolyline are used in the next two hacks. In addition, the API includes GXml and GXslt objects for parsing XML and using XSLT technology.
The API also includes a general-purpose function, GBrowserIsCompatible( ), which returns TRue if the user's browser supports Google Maps. As of November 2005, according to the Google documentation, Google Maps supported recent versions of Firefox/Mozilla, IE 5.5+, and Safari 1.2+, and "sort of" supported Opera. It did not support IE 5.0.
"Use the Google Maps API Request Object" [Hack #29] and "Use Ajax with a Google Maps and Yahoo! Maps Mash-up" [Hack #30] show how to use the Google Maps API. Visit the above-mentioned URL to obtain an API key, take a look at the developer's documentation at http://www.google.com/apis/maps/documentation/, and start cracking!