This section contains an alphabetical reference for all KML elements defined in KML Version 2.2. The class tree for KML elements is shown below. In this diagram, elements to the right on a particular branch in the tree are extensions of the elements to their left. For example, Placemark is a special kind of Feature. It contains all of the elements that belong to Feature, and it adds some elements that are specific to the Placemark element.
KML is an open standard officially named the OpenGIS® KML Encoding Standard (OGC KML). It is maintained by the Open Geospatial Consortium, Inc. (OGC). The complete specification for OGC KML can be found at http://www.opengeospatial.org/standards/kml/.
The complete XML schema for KML is located at http://schemas.opengis.net/kml/.
Note: Click an element name in this diagram to jump to its entry in the reference section.
Note that abstract elements (shown in italics and in dotted boxes in the diagram) are not actually used in KML files. They are a useful way for a single element to serve as the programmatic foundation for multiple similar (but different) derived elements. Understanding this object-oriented hierarchy is also a good way for you to learn KML, since you can easily see groupings of related elements.
All elements derived from Object can have an id assigned to them. This id is used by the KML update mechanism (see <Update>) for files loaded with a NetworkLink. It is also used by shared styles (see <Style>). The id is a standard XML ID.
Because KML is an XML grammar and file format, tag names are case-sensitive and must appear exactly as shown here. If you're familiar with XML, you will also be interested in the KML 2.2 Schema. When you are editing KML text files, you can load this Schema into any XML editor and validate your KML code with it.
Tip: Viewing KML for Google Earth Features
Here is a handy feature of Google Earth that makes it easy to view the KML file for any Feature. In Google Earth, you can right-click a Feature in the Places panel and copy it. To view the corresponding KML for the copied object, open your favorite text editor and paste the selection into it.
Compatibility
KML versions have a double numbering system: majorVersion.minorVersion. All versions with the same majorVersion are compatible. For this reason, if you change the namespace to "2.2" (that is, xmlns="http://www.opengis.net/kml/2.2"), all KML 2.1 files validate in the KML 2.2 schema.
Each reference entry includes a Syntax section that lists the elements contained in the main element. This Syntax section is an informal listing and uses simple shorthand to summarize the elements. This section also contains the following:
The Syntax section can be copied and used as a template for any non-abstract element in a KML file.
KML uses common XML types such as boolean, string, double, float, and int. In addition, it defines a number of field element types. The following table lists some of the most commonly used types defined in KML and links to sample elements that use them:
| Field Type | Value | Example Use |
|---|---|---|
| altitudeModeEnum | clampToGround, relativeToGround, absolute | See <LookAt> and <Region> |
| angle90 | a value ≥−90 and ≤90 | See <latitude> in <Model> |
| anglepos90 | a value ≥0 and ≤90 | See <tilt> in <LookAt> |
| angle180 | a value ≥−180 and ≤180 | See <longitude> in <Model> |
| angle360 | a value ≥−360 and ≤360 | See <heading>, <tilt>, and <roll> in <Orientation> |
| color | hexBinary value: aabbggrr | See any element that extends <ColorStyle> |
| colorModeEnum | normal, random | See any element that extends <ColorStyle> |
| dateTime | dateTime, date, gYearMonth, gYear | See <TimeSpan> and <TimeStamp> |
| displayModeEnum | default, hide | See <BalloonStyle> |
| gridOrigin | lowerLeft, upperLeft | See <PhotoOverlay> |
| refreshModeEnum | onChange, onInterval, onExpire | See <Link> |
| shapeEnum | rectangle, cylinder, sphere | See <PhotoOverlay> |
| styleStateEnum | normal, highlight | See <StyleMap> |
| unitsEnum | fraction, pixels, insetPixels | See <hotSpot> in <IconStyle>, <ScreenOverlay> |
| vec2 | x=double xunits=kml:unitsEnum y=double yunits=kml:unitsEnum |
See <hotSpot> in <IconStyle>, <ScreenOverlay> |
| viewRefreshEnum | never, onRequest, onStop, onRegion | See <Link> |
<!-- abstract element; do not create -->
<!-- AbstractView --> <!-- Camera, LookAt -->
<!-- extends Object -->
<-- /AbstractView -->
This is an abstract element and cannot be used directly in a KML file. This element is extended by the <Camera> and <LookAt> elements.
<BalloonStyle id="ID">
<!-- specific to BalloonStyle -->
<bgColor>ffffffff</bgColor> <!-- kml:color -->
<textColor>ff000000</textColor> <!-- kml:color -->
<text>...</text> <!-- string -->
<displayMode>default</displayMode> <!-- kml:displayModeEnum -->
</BalloonStyle>
Specifies how the description balloon for placemarks is drawn. The <bgColor>, if specified, is used as the background color of the balloon. See <Feature> for a diagram illustrating how the default description balloon appears in Google Earth.
Note: The use of the <color> element within <BalloonStyle> has been deprecated. Use <bgColor> instead.
<text>This is $[name], whose description is:<br/>$[description]</text>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document> <name>BalloonStyle.kml</name>
<open>1</open>
<Style id="exampleBalloonStyle">
<BalloonStyle>
<!-- a background color for the balloon -->
<bgColor>ffffffbb</bgColor>
<!-- styling of the balloon text -->
<text><![CDATA[
<b><font color="#CC0000" size="+3">$[name]</font></b>
<br/><br/>
<font face="Courier">$[description]</font>
<br/><br/>
Extra text that will appear in the description balloon
<br/><br/>
<!-- insert the to/from hyperlinks -->
$[geDirections]
]]></text>
</BalloonStyle>
</Style>
<Placemark>
<name>BalloonStyle</name>
<description>An example of BalloonStyle</description>
<styleUrl>#exampleBalloonStyle</styleUrl>
<Point>
<coordinates>-122.370533,37.823842,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
<Camera id="ID">
<longitude>0</longitude> <!-- kml:angle180 -->
<latitude>0</latitude> <!-- kml:angle90 -->
<altitude>0</altitude> <!-- double -->
<heading>0</heading> <!-- kml:angle360 -->
<tilt>0</tilt> <!-- kml:anglepos180 -->
<roll>0</roll> <!-- kml:angle180 -->
<altitudeMode>clampToGround</altitudeMode>
<!-- kml:altitudeModeEnum: relativeToGround, clampToGround, or absolute -->
</Camera>
Defines the virtual camera that views the scene. This element defines the position of the camera relative to the Earth's surface as well as the viewing direction of the camera. The camera position is defined by <longitude>, <latitude>, <altitude>, and <altitudeMode>. The viewing direction of the camera is defined by <heading>, <tilt>, and <roll>. <Camera> can be a child element of any <Feature> or of <NetworkLinkControl>. A parent element cannot contain both a <Camera> and a <LookAt> at the same time.
<Camera> provides full six-degrees-of-freedom control over the view, so you can position the Camera in space and then rotate it around the X, Y, and Z axes. Most importantly, you can tilt the camera view so that you're looking above the horizon into the sky.
Within a <Feature> or <NetworkLinkControl>, use either a <Camera> or a <LookAt> object (but not both in the same object). The <Camera> object defines the viewpoint in terms of the viewer's position and orientation. The <Camera> object allows you to specify a view that is not on the Earth's surface. The <LookAt> object defines the viewpoint in terms of what is being viewed. The <LookAt> object is more limited in scope than <Camera> and generally requires that the view direction intersect the Earth's surface.
The following diagram shows the X, Y, and Z axes, which are attached to the virtual camera.

The order of rotation is important. By default, the camera is looking straight down the −Z axis toward the Earth. Before rotations are performed, the camera is translated along the Z axis to <altitude>. The order of transformations is as follows:
Note that each time a rotation is applied, two of the camera axes change their orientation.
<!-- abstract element; do not create --> <!-- ColorStyle id="ID" --> <!-- IconStyle,LabelStyle,LineStyle,PolyStyle --> <color>ffffffff</color> <!-- kml:color --> <colorMode>normal</colorMode> <!-- kml:colorModeEnum: normal or random --> <!-- /ColorStyle -->
This is an abstract element and cannot be used directly in a KML file. It provides elements for specifying the color and color mode of extended style types.
<!-- abstract element; do not create --> <!-- Container id="ID" --> <!-- Document,Folder --> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <address>...</address> <!-- string --> <AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">...
</AddressDetails> <!-- string --> <phoneNumber>...</phoneNumber> <!-- string -->
<Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- LookAt or Camera --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <atom:author>...<atom:author> <!-- xmlns:atom="http://www.w3.org/2005/Atom" --> <atom:link>...</atom:link> <!-- specific to Container -->
<!-- 0 or more Features --> <!-- /Container -->
This is an abstract element and cannot be used directly in a KML file. A Container element holds one or more Features and allows the creation of nested hierarchies.
<Document id="ID"> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <atom:author>...<atom:author> <!-- xmlns:atom --> <atom:link>...</atom:link> <!-- xmlns:atom --> <address>...</address> <!-- string --> <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal -->
<phoneNumber>...</phoneNumber> <!-- string -->
<Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- Camera or LookAt --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <!-- deprecated in KML 2.2 --> <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 --> <!-- specific to Document --> <!-- 0 or more Schema elements --> <!-- 0 or more Feature elements --> </Document>
A Document is a container for features and styles. This element is required if your KML file uses shared styles. It is recommended that you use shared styles, which require the following steps:
Note that shared styles are not inherited by the Features in the Document.
Each Feature must explicitly reference the styles it uses in a <styleUrl> element. For a Style that applies to a Document (such as ListStyle), the Document itself must explicitly reference the <styleUrl>. For example:
<Document> <Style id="myPrettyDocument"> <ListStyle> ... </ListStyle> </Style> <styleUrl#myPrettyDocument"> ... </Document>
Do not put shared styles within a Folder.
The following example illustrates use of a shared style.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Document.kml</name>
<open>1</open> <Style id="exampleStyleDocument">
<LabelStyle>
<color>ff0000cc</color>
</LabelStyle>
</Style>
<Placemark>
<name>Document Feature 1</name>
<styleUrl>#exampleStyleDocument</styleUrl>
<Point>
<coordinates>-122.371,37.816,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Document Feature 2</name>
<styleUrl>#exampleStyleDocument</styleUrl>
<Point>
<coordinates>-122.370,37.817,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
<ExtendedData>
<Data name="string">
<displayName>...</displayName> <!-- string -->
<value>...</value> <!-- string -->
</Data> <SchemaData schemaUrl="anyURI">
<SimpleData name=""> ... </SimpleData> <!-- string -->
</SchemaData> <namespace_prefix:other>...</namespace_prefix:other> </ExtendedData>
The ExtendedData element offers three techniques for adding custom data to a KML Feature (NetworkLink, Placemark, GroundOverlay, PhotoOverlay, ScreenOverlay, Document, Folder). These techniques are
These techniques can be combined within a single KML file or Feature for different pieces of data.
For more information, see Adding Custom Data in "Topics in KML."
<Placemark>
<name>Club house</name>
<ExtendedData>
<Data name="holeNumber">
<value>1</value>
</Data>
<Data name="holeYardage">
<value>234</value>
</Data>
<Data name="holePar">
<value>4</value>
</Data>
</ExtendedData>
</Placemark>
schemaUrl="http://host.com/PlacesIHaveLived.kml#my-schema-id"
schemaUrl="AnotherFile.kml#my-schema-id"
schemaUrl="#schema-id" <!-- same file -->
<Placemark>
<name>Easy trail</name>
<ExtendedData>
<SchemaData schemaUrl="#TrailHeadTypeId">
<SimpleData name="TrailHeadName">Pi in the sky</SimpleData>
<SimpleData name="TrailLength">3.14159</SimpleData>
<SimpleData name="ElevationGain">10</SimpleData>
</SchemaData>
</ExtendedData>
<Point>
<coordinates>-122.000,37.002</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Difficult trail</name>
<ExtendedData>
<SchemaData schemaUrl="#TrailHeadTypeId">
<SimpleData name="TrailHeadName">Mount Everest</SimpleData>
<SimpleData name="TrailLength">347.45</SimpleData>
<SimpleData name="ElevationGain">10000</SimpleData>
</SchemaData>
</ExtendedData>
<Point>
<coordinates>-122.000,37.002</coordinates>
</Point>
</Placemark>
<ExtendedData xmlns:prefix="camp">
<camp:number>14</camp:number>
<camp:parkingSpaces>2</camp:parkingSpaces>
<camp:tentSites>4</camp:tentSites>
</ExtendedData>
<!-- abstract element; do not create -->
<!-- Feature id="ID" --> <!-- Document,Folder,
NetworkLink,Placemark,
GroundOverlay,PhotoOverlay,ScreenOverlay -->
<name>...</name> <!-- string -->
<visibility>1</visibility> <!-- boolean -->
<open>0</open> <!-- boolean -->
<atom:author>...<atom:author> <!-- xmlns:atom -->
<atom:link>...</atom:link> <!-- xmlns:atom -->
<address>...</address> <!-- string -->
<xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal -->
<phoneNumber>...</phoneNumber> <!-- string -->
<Snippet maxLines="2">...</Snippet> <!-- string -->
<description>...</description> <!-- string -->
<AbstractView>...</AbstractView> <!-- Camera or LookAt -->
<TimePrimitive>...</TimePrimitive> <!-- TimeStamp or TimeSpan -->
<styleUrl>...</styleUrl> <!-- anyURI -->
<StyleSelector>...</StyleSelector>
<Region>...</Region>
<Metadata>...</Metadata> <!-- deprecated in KML 2.2 -->
<ExtendedData>...</ExtendedData> <!-- new in KML 2.2 -->
<-- /Feature -->
This is an abstract element and cannot be used directly in a KML file. The following diagram shows how some of a Feature's elements appear in Google Earth.
KML 2.2 supports new elements for including data about the author and related website in your KML file. This information is displayed in geo search results, both in Earth browsers such as Google Earth, and in other applications such as Google Maps. The ascription elements used in KML are as follows:
These elements are defined in the Atom Syndication Format. The complete specification is found at http://atompub.org. Be sure to include the namespace for this element in any KML file that uses it: xmlns:atom="http://www.w3.org/2005/Atom" (see the sample that follows).
The <atom:author> element is the parent element for <atom:name>, which specifies the author of the KML feature.
xmlns:atom="http://www.w3.org/2005/Atom" (see the sample that follows).xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"User-supplied text that appears in the description balloon.
The <description> element supports plain text as well as a subset of HTML formatting elements, including tables (see KML example below). It does not support other web-based technology, such as dynamic page markup (PHP, JSP, ASP), scripting languages (VBScript, Javascript), nor application languages (Java, Python). In Google Earth release 4.2, video is supported. (See Example below.)
If your description contains no HTML markup, Google Earth attempts to format it, replacing newlines with <br> and wrapping URLs with anchor tags. A valid URL string for the World Wide Web is automatically converted to a hyperlink to that URL (e.g., http://www.google.com). Consequently, you do not need to surround a URL with the <a href="http://.."></a> tags in order to achieve a simple link.
When using HTML to create a hyperlink around a specific word, or when including images in the HTML, you must use HTML entity references or the CDATA element to escape angle brackets, apostrophes, and other special characters. The CDATA element tells the XML parser to ignore special characters used within the brackets. This element takes the form of:
<![CDATA[ special characters here ]]>
If you prefer not to use the CDATA element, you can use entity references to replace all the special characters.
<description> <![CDATA[ This is an image <img src="icon.jpg">
and we have a link http://www.google.com. ]]> </description>
Other Behavior Specified Through Use of the <a> Element
KML 2.2 supports the use of two attributes within the <a> element: href and type.
The anchor element <a> contains an href attribute that specifies a URL.
If the href is a KML file and has a .kml or .kmz file extension, Google Earth loads that file directly when the user clicks it. If the URL ends with an extension not known to Google Earth (for example, .html), the URL is sent to the browser.
The href can be a fragment URL (that is, a URL with a # sign followed by a KML identifier). When the user clicks a link that includes a fragment URL, by default the browser flies to the Feature whose ID matches the fragment. If the Feature has a LookAt or Camera element, the Feature is viewed from the specified viewpoint.
The behavior can be further specified by appending one of the following three strings to the fragment URL:
For example, the following code indicates to open the file CraftsFairs.kml, fly to the Placemark whose ID is "Albuquerque," and open its balloon:
<description> <![CDATA[
<a href="http://myServer.com/CraftsFairs.kml#Albuquerque;balloonFlyto">
One of the Best Art Shows in the West</a> ]]> </description>
The type attribute is used within the <a> element when the href does not end in .kml or .kmz, but the reference needs to be interpreted in the context of KML. Specify the following:
type="application/vnd.google-earth.kml+xml"
For example, the following URL uses the type attribute to notify Google Earth that it should attempt to load the file, even though the file extension is .php:
<a href="myserver.com/cgi-bin/generate-kml.php#placemark123"
type="application/vnd.google-earth.kml+xml">
<styleUrl>#myIconStyleID</styleUrl>
<styleUrl>http://someserver.com/somestylefile.xml#restaurant</styleUrl>
<styleUrl>eateries.kml#my-lunch-spot</styleUrl>
This example illustrates the complete set of HTML elements supported by the <description> element.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Feature.kml</name> <Snippet maxLines="4">
The snippet is a way of
providing an alternative
description that will be
shown in the List view.
</Snippet>
<description>
<![CDATA[
Styles: <i>Italics</i>, <b>Bold</b>, <u>Underlined</u>,
<s>Strike Out</s>, subscript<sub>subscript</sub>,
superscript<sup>superscript</sup>,
<big>Big</big>, <small>Small</small>, <tt>Typewriter</tt>,
<em>Emphasized</em>, <strong>Strong</strong>, <code>Code</code>
<hr />
Fonts:
<font color="red">red by name</font>,
<font color="#408010">leaf green by hexadecimal RGB</font>,
<font size=1>size 1</font>, <font size=2>size 2</font>,
<font size=3>size 3</font>, <font size=4>size 4</font>,
<font size=5>size 5</font>, <font size=6>size 6</font>,
<font size=7>size 7</font>,
<font face=times>Times</font>,
<font face=verdana>Verdana</font>,
<font face=arial>Arial</font>
<br/>
<hr />
Links:
<a href="http://doc.trolltech.com/3.3/qstylesheet.html">
QT Rich Text Rendering
</a>
<br />
<hr />
Alignment:
<br />
<p align=left>left</p><p align=center>center</p>
<p align=right>right</p>
<hr />
Ordered Lists:
<br />
<ol><li>First</li><li>Second</li><li>Third</li></ol>
<ol type="a"><li>First</li><li>Second</li><li>Third</li></ol>
<ol type="A"><li>First</li><li>Second</li><li>Third</li></ol>
<hr />
Unordered Lists:
<br />
<ul><li>A</li><li>B</li><li>C</li></ul>
<ul type="circle"><li>A</li><li>B</li><li>C</li></ul>
<ul type="square"><li>A</li><li>B</li><li>C</li></ul>
<hr />
Definitions:
<br />
<dl>
<dt>Scrumpy</dt>
<dd>Hard English cider from the west country</dd>
<dt>Pentanque</dt>
<dd>A form of boules where the goal is to throw metal ball as
close as possible to a jack</dd>
</dl>
<hr />
Block Quote:
<br />
<blockquote>
We shall not cease from exploration<br />
And the end of all our exploring<br />
Will be to arrive where we started<br />
And know the place for the first time
</blockquote>
<br />
<hr />
Centered:
<br />
<center>See, I have a Rhyme assisting<br />
my feeble brain,<br />
its tasks oft-times resisting!</center>
<hr />
Headings:
<br />
<h1>Header 1</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
<h3>Header 4</h4>
<h3>Header 5</h5>
<hr />
Images:
<br />
<img src="http://earth.google.com/images/googleearth.gif" />
<br />
<i>Scaled image</i>
<br />
<img src="http://earth.google.com/images/googleearth.gif"
width="100" />
<br />
<hr />
Tables:
<table border="1" padding="3" width="300">
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr>
<tr><td>a</td><td>b</td><td>c</td><td>d</td><td>e</td></tr>
</table>
]]>
</description> <Point>
<coordinates>-122.378927,37.826793,0</coordinates>
</Point>
</Placemark>
</kml>
This example shows use of the <atom:author>, <atom:name> and <atom:link> elements from the Atom namespace. Note that you need to reference this namespace within the <kml> element.
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<atom:author>
<atom:name>J. K. Rowling</atom:name>
</atom:author>
<atom:link href="http://www.harrypotter.com" />
<Placemark>
<name>Hogwarts</name>
<Point>
<coordinates>1,1</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Little Hangleton</name>
<Point>
<coordinates>1,2</coordinates>
</Point>
</Placemark>
</Document>
</kml>
This example shows how to embed a Flash video inside the Balloon.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document> <name>Video Example</name>
<Style id="sn_blue-dot_copy3">
<IconStyle>
<Icon>
<href>http://www.google.com/intl/en_us/mapfiles/ms/icons/blue-dot.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>Placemark</name>
<description>
<![CDATA[<div style="font-size:larger">
<div>
<div style="width: 212px; font-size: 12px;">
<b>The Spaghetti Film</b>
</div>
<div style="font-size: 11px;">
<a target="_blank" href="http://www.youtube.com/?v=FICUvrVlyXc">
http://www.youtube.com/?v=FICUvrVlyXc</a><br>
</div><br>
<div style="margin-left: auto; margin-right:auto;">
<object height="175" width="212">
<param value="http://www.youtube.com/v/FICUvrVlyXc" name="movie">
<param value="transparent" name="wmode">
<embed wmode="transparent" type="application/x-shockwave-flash"
src="http://www.youtube.com/v/FICUvrVlyXc" height="175"
width="212">
</object>
</div>
</div>
</div>
<div style="font-size: smaller; margin-top: 1em;">Saved from
<a href="http://maps.google.com/ig/add?synd=mpl&pid=mpl&moduleurl=
http:%2F%2Fwww.google.com%2Fig%2Fmodules%2Fmapplets-youtube.xml&hl=en&gl=us">
YouTubeVideos</a>
</div>
]]>
</description>
<styleUrl>#sn_blue-dot_copy3</styleUrl>
<Point>
<coordinates>-93.47875999999999,45.083248,0</coordinates>
</Point>
</Placemark>
</Document> </kml>
<Folder id="ID"> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <atom:author>...<atom:author> <!-- xmlns:atom --> <atom:link>...</atom:link> <!-- xmlns:atom --> <address>...</address> <!-- string --> <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal -->
<phoneNumber>...</phoneNumber> <!-- string -->
<Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- Camera or LookAt --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <!-- deprecated in KML 2.2 --> <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 --> <!-- specific to Folder --> <!-- 0 or more Feature elements --> </Folder>
A Folder is used to arrange other Features hierarchically (Folders, Placemarks, NetworkLinks, or Overlays). A Feature is visible only if it and all its ancestors are visible.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>Folder.kml</name> <open>1</open>
<description>
A folder is a container that can hold multiple other objects
</description>
<Placemark>
<name>Folder object 1 (Placemark)</name>
<Point>
<coordinates>-122.377588,37.830266,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Folder object 2 (Polygon)</name>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-122.377830,37.830445,0
-122.377576,37.830631,0
-122.377840,37.830642,0
-122.377830,37.830445,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>Folder object 3 (Path)</name>
<LineString>
<tessellate>1</tessellate>
<coordinates>
-122.378009,37.830128,0 -122.377885,37.830379,0
</coordinates>
</LineString>
</Placemark>
</Folder>
</kml>
<!-- abstract element; do not create -->
<!-- Geometry id="ID" --> <!-- Point,LineString,LinearRing,
Polygon,MultiGeometry,Model -->
<!-- /Geometry -->
This is an abstract element and cannot be used directly in a KML file. It provides a placeholder object for all derived Geometry objects.
<GroundOverlay id="ID"> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <atom:author>...<atom:author> <!-- xmlns:atom --> <atom:link>...</atom:link> <!-- xmlns:atom --> <address>...</address> <!-- string --> <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal -->
<phoneNumber>...</phoneNumber> <!-- string -->
<Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- Camera or LookAt --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <!-- deprecated in KML 2.2 --> <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 --> <!-- inherited from Overlay element --> <color>ffffffff</color> <!-- kml:color --> <drawOrder>0</drawOrder> <!-- int --> <Icon>...</Icon> <!-- specific to GroundOverlay --> <altitude>0</altitude> <!-- double --> <altitudeMode>clampToGround</altitudeMode> <!-- kml:altitudeModeEnum: clampToGround or absolute --> <LatLonBox> <north>...</north> <! kml:angle90 --> <south>...</south> <! kml:angle90 --> <east>...</east> <! kml:angle180 --> <west>...</west> <! kml:angle180 --> <rotation>0</rotation> <! kml:angle180 --> </LatLonBox> </GroundOverlay>
This element draws an image overlay draped onto the terrain. The <href> child of <Icon> specifies the image to be used as the overlay. This file can be either on a local file system or on a web server. If this element is omitted or contains no <href>, a rectangle is drawn using the color and size defined by the screen overlay.
<LatLonBox> <north>48.25475939255556</north> <south>48.25207367852141</south> <east>-90.86591508839973</east> <west>-90.8714285289695</west> <rotation>39.37878630116985</rotation> </LatLonBox>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<GroundOverlay>
<name>GroundOverlay.kml</name>
<color>7fffffff</color>
<drawOrder>1</drawOrder>
<Icon>
<href>http://www.google.com/intl/en/images/logo.gif</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>86400</refreshInterval>
<viewBoundScale>0.75</viewBoundScale>
</Icon>
<LatLonBox>
<north>37.83234</north>
<south>37.832122</south>
<east>-122.373033</east>
<west>-122.373724</west>
<rotation>45</rotation>
</LatLonBox>
</GroundOverlay>
</kml>
<Icon id="ID">
<!-- specific to Icon -->
<href>...</href> <!-- anyURI -->
<refreshMode>onChange</refreshMode>
<!-- kml:refreshModeEnum: onChange, onInterval, or onExpire -->
<refreshInterval>4</refreshInterval> <!-- float -->
<viewRefreshMode>never</viewRefreshMode>
<!-- kml:viewRefreshModeEnum: never, onStop, onRequest, onRegion -->
<viewRefreshTime>4</viewRefreshTime> <!-- float -->
<viewBoundScale>1</viewBoundScale> <!-- float -->
<viewFormat>...</viewFormat> <!-- string -->
<httpQuery>...</httpQuery> <!-- string -->
</Icon>
Defines an image associated with an Icon style or overlay. <Icon> has the same child elements as <Link>. The required <href> child element defines the location of the image to be used as the overlay or as the icon for the placemark. This location can either be on a local file system or a remote web server.
<Icon> <href>Sunset.jpg</href> </Icon>
<IconStyle id="ID">
<!-- inherited from ColorStyle -->
<color>ffffffff</color> <!-- kml:color -->
<colorMode>normal</colorMode> <!-- kml:colorModeEnum:normal or random -->
<!-- specific to IconStyle -->
<scale>1</scale> <!-- float -->
<heading>0</heading> <!-- float -->
<Icon>
<href>...</href>
</Icon>
<hotSpot x="0.5" y="0.5"
xunits="fraction" yunits="fraction"/> <!-- kml:vec2 -->
</IconStyle>
Specifies how icons for point Placemarks are drawn, both in the Places panel and in the 3D viewer of Google Earth. The <Icon> element specifies the icon image. The <scale> element specifies the x, y scaling of the icon. The color specified in the <color> element of <IconStyle> is blended with the color of the <Icon>.
Note: The <geomScale> tag has been deprecated. Use <scale> instead.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="randomColorIcon">
<IconStyle>
<color>ff00ff00</color>
<colorMode>random</colorMode>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon21.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>IconStyle.kml</name>
<styleUrl>#randomColorIcon</styleUrl>
<Point>
<coordinates>-122.36868,37.831145,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
<kml xmlns="http://www.opengis.net/kml/2.2" hint="target=sky"> ... </kml>
The root element of a KML file. This element is required. It follows the xml declaration at the beginning of the file. The hint attribute is used as a signal to Google Earth to display the file as celestial data.
The <kml> element may also include the namespace for any external XML schemas that are referenced within the file.
A basic <kml> element contains 0 or 1 Feature and 0 or 1 NetworkLinkControl:
<kml xmlns="http://www.opengis.net/kml/2.2"> <NetworkLinkControl> ... </NetworkLinkControl> <!-- 0 or 1 Feature elements --> </kml>
<LabelStyle id="ID"> <!-- inherited from ColorStyle --> <color>ffffffff</color> <!-- kml:color --> <colorMode>normal</colorMode> <!-- kml:colorModeEnum: normal or random --> <!-- specific to LabelStyle --> <scale>1</scale> <!-- float --> </LabelStyle>
Specifies how the <name> of a Feature is drawn in the 3D viewer. A custom color, color mode, and scale for the label (name) can be specified.
Note: The <labelColor> tag is deprecated. Use <LabelStyle> instead.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="randomLabelColor">
<LabelStyle>
<color>ff0000cc</color>
<colorMode>random</colorMode>
<scale>1.5</scale>
</LabelStyle>
</Style>
<Placemark>
<name>LabelStyle.kml</name>
<styleUrl>#randomLabelColor</styleUrl>
<Point>
<coordinates>-122.367375,37.829192,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
<LinearRing id="ID">
<!-- specific to LinearRing -->
<extrude>0</extrude> <!-- boolean -->
<tessellate>0</tessellate> <!-- boolean -->
<altitudeMode>clampToGround</altitudeMode>
<!-- kml:altitudeModeEnum: clampToGround, relativeToGround, or absolute -->
<coordinates>...</coordinates> <!-- lon,lat[,alt] tuples -->
</LinearRing>
Defines a closed line string, typically the outer boundary of a Polygon. Optionally, a LinearRing can also be used as the inner boundary of a Polygon to create holes in the Polygon. A Polygon can contain multiple <LinearRing> elements used as inner boundaries.
Note: In Google Earth, a Polygon with an <altitudeMode> of clampToGround follows the great circle; however, a LinearRing (by itself) with an <altitudeMode> of clampToGround follows lines of constant latitude.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>LinearRing.kml</name>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates> -122.365662,37.826988,0 -122.365202,37.826302,0 -122.364581,37.82655,0 -122.365038,37.827237,0 -122.365662,37.826988,0 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</kml>
<LineString id="ID">
<!-- specific to LineString -->
<extrude>0</extrude> <!-- boolean -->
<tessellate>0</tessellate> <!-- boolean -->
<altitudeMode>clampToGround</altitudeMode>
<!-- kml:altitudeModeEnum: clampToGround, relativeToGround, or absolute -->
<coordinates>...</coordinates> <!-- lon,lat[,alt] -->
</LineString>
Defines a connected set of line segments. Use <LineStyle> to specify the color, color mode, and width of the line. When a LineString is extruded, the line is extended to the ground, forming a polygon that looks somewhat like a wall or fence. For extruded LineStrings, the line itself uses the current LineStyle, and the extrusion uses the current PolyStyle. See the KML Tutorial for examples of LineStrings (or paths).
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>LineString.kml</name>
<open>1</open>
<LookAt>
<longitude>-122.36415</longitude>
<latitude>37.824553</latitude>
<altitude>0</altitude>
<range>150</range>
<tilt>50</tilt>
<heading>0</heading>
</LookAt>
<Placemark>
<name>unextruded</name>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<coordinates>
-122.364383,37.824664,0 -122.364152,37.824322,0 </coordinates>
</LineString>
</Placemark>
<Placemark>
<name>extruded</name>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>
-122.364167,37.824787,50 -122.363917,37.824423,50 </coordinates>
</LineString>
</Placemark>
</Document>
</kml>
<LineStyle id="ID"> <!-- inherited from ColorStyle --> <color>ffffffff</color> <!-- kml:color --> <colorMode>normal</colorMode> <!-- colorModeEnum: normal or random --> <!-- specific to LineStyle --> <width>1</width> <!-- float --> </LineStyle>
Specifies the drawing style (color, color mode, and line width) for all line geometry. Line geometry includes the outlines of outlined polygons and the extruded "tether" of Placemark icons (if extrusion is enabled).
The following example shows a 50 percent opaque red line with a width of 4 pixels.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>LineStyle.kml</name>
<open>1</open>
<Style id="linestyleExample">
<LineStyle>
<color>7f0000ff</color>
<width>4</width>
</LineStyle>
</Style>
<Placemark>
<name>LineStyle Example</name>
<styleUrl>#linestyleExample</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<coordinates>
-122.364383,37.824664,0 -122.364152,37.824322,0 </coordinates>
</LineString>
</Placemark>
</Document>
</kml>
<Link id="ID">
<!-- specific to Link -->
<href>...</href> <!-- string -->
<refreshMode>onChange</refreshMode>
<!-- refreshModeEnum: onChange, onInterval, or onExpire -->
<refreshInterval>4</refreshInterval> <!-- float -->
<viewRefreshMode>never</viewRefreshMode>
<!-- viewRefreshModeEnum: never, onStop, onRequest, onRegion -->
<viewRefreshTime>4</viewRefreshTime> <!-- float -->
<viewBoundScale>1</viewBoundScale> <!-- float -->
<viewFormat>BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]</viewFormat>
<!-- string -->
<httpQuery>...</httpQuery> <!-- string -->
</Link>
<Link> specifies the location of any of the following:
The file is conditionally loaded and refreshed, depending on the refresh parameters supplied here. Two different sets of refresh parameters can be specified: one set is based on time (<refreshMode> and <refreshInterval>) and one is based on the current "camera" view (<viewRefreshMode> and <viewRefreshTime>). In addition, Link specifies whether to scale the bounding box parameters that are sent to the server (<viewBoundScale> and provides a set of optional viewing parameters that can be sent to the server (<viewFormat>) as well as a set of optional parameters containing version and language information.
When a file is fetched, the URL that is sent to the server is composed of three pieces of information:
If the file specified in <href> is a local file, the <viewFormat> and <httpQuery> elements are not used.
The <Link> element replaces the <Url> element of <NetworkLink> contained in earlier KML releases and adds functionality for the <Region> element (introduced in KML 2.1). In Google Earth releases 3.0 and earlier, the <Link> element is ignored.