My favorites | English | Sign in

KML Support

This page outlines KML support in Google Maps and Google Maps for mobile.

KML in Google Maps

Google Maps supports the following KML elements (that is, KML queries in the Search box and GGeoXml objects in the Maps API):

  • Placemarks
  • Icons
  • Folders
  • Descriptive HTML
  • KMZ (compressed KML, including attached images)
  • Polylines and polygons
  • Styles for polylines and polygons, including color, fill, and opacity
  • Network links to import data dynamically
  • Ground overlays and screen overlays

This list does not apply to Google Earth's export to Google Maps, My Maps import, or My Maps export to Google Earth.

The KML parser generally silently ignores XML tags it does not understand. Refer to KML Elements in Google Maps for further details.

Size and Complexity Restrictions for KML Rendering in Google Maps

Google Maps currently has specific limitations to the size and complexity of loaded KML files. Below is a summary of the current limits:

Note: these limits are temporary and are subject to change at any time.

Maximum fetched file size (raw KML, raw GeoRSS, or compressed KMZ)3MB
Maximum uncompressed KML file size10MB
Maximum number of Network Links10
Maximum number of total document-wide features1,000

Server-side versus Client-side KML Rendering

When KML content containing a large number of features (placemarks, polygons, lines) is loaded into Google Maps, a server-side decision is made about whether or not to render the document's features on the server or in the user's web browser. The user experience, including feature appearance and interactivity, will not be affected by this decision; the content will look and behave the same way, regardless of the chosen method.

However, there is a subtle difference in the behavior of these methods that surfaces when using the GGeoXml class to render KML content in the Google Maps API. When simple KML files are loaded via GGeoXml and client-side, browser-based feature rendering is chosen, GOverlay-based objects are created and added to the map, triggering addoverlay events accordingly. On the other hand, when large KML files are loaded with GGeoXml and server-side rendering is invoked, these objects are not created and addoverlay is not triggered. For this reason, it is not recommended to rely on the addoverlay event being triggered on individual KML features loaded via GGeoXml.

KML in Google Maps for Mobile

Google Maps for mobile supports this subset of KML elements:

  • Placemarks with <name> elements
  • Points
  • Icons
  • Folders
  • HTML in the <description> element
  • KMZ (compressed KML, including attached images)
  • LineStrings and Polygons
  • Styles for polylines and polygons, including color, fill, and opacity

There are a number of ways to access KML in Google Maps for mobile:

  • KML is mixed in with search results for many queries. Try searching for "wedding tahiti".
  • For queries that don't return KML in the top ten, you can explicitly restrict the search to return only KML:
    1. Search for something, like "pizza sf"
    2. Scroll to the bottom of the results list
    3. Select "Didn't find what you were looking for?"
    4. Select "Try user-created content"... and you'll get only KML results
  • Enter a KML URL into the search box, like "http://bbs.keyhole.com/ubb/download.php?Number=438084"
  • On a Blackberry with Google Maps for mobile installed, go to the web browser and find a page with a link to a KML document (.kml/.kmz). Clicking the link should invoke Google Maps for mobile and automatically bring up the KML file on top of the map.

A couple of caveats:

  • There are a number of aspects of KML that don't work well (or at all) on a small 2D screen, such as altitude and camera angle.
  • In some cases, the KML document is trimmed so that it fits on a phone. For example, images are scaled, and very large KML files are truncated.