Table of Contents

KML

KML


version 2.2
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. KML uses a tag-based structure with nested elements and attributes and is based on the XML standard.

Data Format

A Placemark is one of the most commonly used features in Google Earth. It marks a position on the Earth's surface, using a yellow pushpin as the icon. The simplest Placemark includes only a <Point> element, which specifies the location of the Placemark. You can specify a name and a custom icon for the Placemark, and you can also add other geometry elements to it.

Open the KML Samples file in Google Earth and expand the Placemarks subfolder. This folder includes three different types of placemark: simple, floating, and extruded.

The structure of this file breaks down as follows:

Example

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"><Document>

   <Style id="blue">
      <IconStyle>
         <Icon> 
           <href>http://maps.google.com/mapfiles/ms/icons/blue.png</href>
         </Icon>
      </IconStyle>
   </Style>

   <Placemark>
      <name>IconStyle.kml</name>
      <styleUrl>#blue</styleUrl>
      <Point>
         <coordinates>-122.36868,37.831145,0</coordinates>
      </Point>
   </Placemark>

   <Style id="blue-dot">
      <IconStyle>
         <Icon> 
           <href>http://maps.google.com/mapfiles/ms/icons/blue-dot.png</href>
         </Icon>
      </IconStyle>
   </Style>

   <Placemark>
      <name>IconStyle.kml</name>
      <styleUrl>#blue-dot</styleUrl>
      <Point>
         <coordinates>-123.36868,37.831145,0</coordinates>
      </Point>
   </Placemark>

</Document>
</kml>