Google Maps API Tutorial

© 2007, 2009 Mike Williams

 
Translate this page:

 

Using googlepages.com

I've recently moved this tutorial from demon.co.uk to googlepages.com because I was regularly exceeding my demon bandwidth limits, which was causing the availability to be degraded.

To obtain space on googlepages.com you need to have a googlemail account.

Contrary to the information displayed as you start to sign up for googlemail, you no longer need to have a mobile phone for the googlemail security check. I wish I'd known that before I went out and bought one.

NAVTEQ and GISrael Streetmaps

The big difference for Google Maps running on googlepages.com is that it is possible to use NAVTEQ streetmaps for North America, instead the of Tele Atlas maps and GISrael streetmaps for Israel instead of the low resolution AND streetmaps. To use NAVTEQ or GISrael maps, omit the &key=... section from the line that loads the API code. The API key check is skipped for domains owned by Google.

Here's an example. Observe that the map details are different from the usual Tele Atlas map, that the copyright text says "NAVTEQ", that the streetmaps now have 19 zoom levels instead of 17, and that there's no logo in the bottom left corner.

However: You can't omit the key if your page uses GClientGeocoder, GDirections or GGeoXml. Those services perform client-side checks on your API key that don't skip the check for domains owned by Google.

But: From APIv2.89 you can use GClientGeocoder by passing your API key as the second parameter of the GClientGeocoder constructor, like this

As well as getting NAVTEQ maps for North America, you'll get updated tiles at the same time as maps.google.com, rather than having to wait a few weeks for the tiles to be released to the API.

MIME Types

googlepages.com appears to use strange MIME Types for some file types.

In particular, it does not use "text/xml" for XML files. This causes xmlDoc = reply.responseXML to fail, and you have to use xmlDoc = GXml.parse(reply.responseText).

Potential Pitfalls

  1. Because the API key check is skipped, you don't get a warning if you happen to be using the wrong key. Your map will still be displayed, but attempts to use GClientGeocoder, GDirections or GGeoXml will simply fail.

  2. If you remove your API key, be careful not to remove the " that follows it.

Back to Mike's Homepage
Up to the start of this tutorial