The Basics

Google Maps API Tutorial

GgeoXml

The GGeoXml() feature creates an overlay from a KML file.

You use it like this:

   var kml = new GGeoXml("http://mydomain.com/myfile.kml");
   map.addOverlay(kml)

Here’s anĀ example

Potential Pitfalls

  1. The KML file must be accessible by the Google KML rendering server. It won’t work with KML files on your local computer. You don’t get any error messages if the KML file is inaccessible.
  2. GGeoXml overlays don’t support .hide() and .show() methods. To hide them, use map.removeOverlay().
  3. Calling map.removeOverlay() on a GGeoXml overlay recovers the memory used, and destroys the information. Once you use map.removeOverlay(xml), you have to re-create it before calling map.addOverlay(xml) again.
Advertisements