What Is KML?

KML is a file format used to display geographic data in an earth browser, such as Google Earth, Google Maps, and Google Maps for mobile. A KML file is processed in much the same way that HTML (and XML) files are processed by web browsers. Like HTML, KML has a tag-based structure with names and attributes used for specific display purposes. Thus, Google Earth and Maps act as browsers for KML files.

You can use KML to:

Annotate the Earth

Mark your favorite spots on Google Earth, and then share those spots with your friends by saving your placemarks as a KML file. Just add a placemark, include some descriptive text, and use the File->Save->Save Place as menu to save the placemarks as a KML file.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
  <Placemark>
    <name>Stonehenge, England</name>
    <description>Stonehenge was built about 2500BC
    </description>
    <Point>
      <coordinates>-1.826752,51.179045
      </coordinates>
    </Point>
  </Placemark> 
</kml>

View KML in Google Maps

You can view KML files on Google Maps in addition to Google Earth. Your KML file must be hosted on a website, so put it online somewhere. Then paste the URL of the file into the search box and hit the “Search” button. Presto, your KML file is now overlaid on top of Google Maps. To share it with your friends, just click “Link to this page” and share the URL with them over email or IM.

The map on the right is an example of using polygons in KML to represent information (in this case, the median age of residents in California).

Google Maps currently supports a subset of KML.

Google Maps for Mobile

Mark your favorite locations and take them with you using Google Maps for mobile. You can now access the KML files you create on the desktop using your mobile phone. Highlight your favorite spots, but remember to keep them simple for best results on your phone. Just like Google Maps for the desktop, Maps for mobile requires that your KML file first be hosted on a website. Once you have a URL for your file on the web, access it by entering the full URL into your phone just as you would enter a regular business search.

The map on the right is an example of using markers in KML to represent information (in this case, the location of crop circles across the UK).

Google Maps for mobile currently supports a subset of KML. More complex KML files may not display on Google.

Resources

Google Earth download: http://earth.google.com/download-earth.html
Google Maps: http://maps.google.com
Google Maps for mobile: http://www.google.com/gmm