What is KML?

KML is a file format used to display geographic data in an Earth browser, such as Google Earth. You can create KML files to pinpoint locations, add image overlays, and expose rich data in new ways. KML is an international standard maintained by the Open Geospatial Consortium, Inc. (OGC).

Who uses KML?

The KML community is wide and varied, as you'll see when you visit the Google Earth community forum. Casual users create KML files to placemark their homes, to document journeys, and to plan cross-country hikes and cycling ventures. Scientists use KML to provide detailed mappings of resources, models, and trends such as volcanic eruptions, weather patterns, earthquake activity, and mineral deposits. Real estate professionals, architects, and city development agencies use KML to propose construction and visualize plans. Students and teachers use KML to explore people, places, and events, both historic and current. Organizations such as National Geographic, UNESCO, and the Smithsonian have all used KML to display their rich sets of global data.

How do I create KML files?

There are three main tools for creating KML files.

  • Google Earth. This is the most important tool that you can use to create KML files. Using Google Earth, you can create
    • Placemarks
    • Paths
    • Polygons
    • Image Overlays
    • Network Links
    • Place models
    • Folders of all of the above
    • PhotoOverlays
  • Once you have created one of these objects, right click on it in the "Places" pane, and select "Copy". You can then paste into a text editor or an XML editor and begin editing it.

  • Text editor. After creating an object in Google Earth, paste it into a text editor, and begin editing it.
  • XML editor. KML is an XML language for describing geographic content. An XML editor is a fancy text editor which gives lots of tools for creating XML documents, such as tag completion, which makes sure that you close your KML elements with the proper close tags.

There are also many tools created by users in the Google Earth community. Check out the KML Developer Support Google Group.

How do I open a KMZ file?

KMZ files are compressed collections of one or more files for viewing in Google Earth. They are compressed using the zip format, and can be opened using any common zip tool, such as "WinZip", "7-Zip", or the default Windows XP Compressed Folders Tool--for Windows, "Stuffit"--for Mac OS, or "zip"--for Mac OS or Linux. You may need to change the file extension from .kmz to .zip to have the file be recognized by a zip tool. Remember to change back to .kmz before using the file again.

How do I create KML for astronomy data?

KML can be used to represent astronomical data, and loaded into Google Sky or Microsoft's WorldWide Telescope. For more information, check out the article Sky Data in KML.

Which KML Tags are supported by Google Earth?

All KML tags are supported by Google Earth. For a list of all tags, see the KML Specification.

Where can I find the Developer Guide?

The Developer Guide can be found at

Why do my lines disappear?

When a LineString has an clampToGround, it follows the curve of the globe without problems. However, if it is "relativeToGround", you may need to add more points or it will draw longer lines in a straight path through the globe or terrain.

For instance, this LineString will go through the Earth, effectively disappearing:

<kml xmlns="">
    <name>Untitled Path</name>
      <coordinates>-115.415105,40.669016 -37.752364,34.879979</coordinates>

Adding more points will reduce the amount of the line that lies underground. <tessellate> should also be "1" to make sure the line follows the terrain.

  <name>Untitled Path</name>
      -134.148103,37.752967 -128.917074,38.803008
      -125.166954,39.583592 -122.137625,39.656880
      -120.421783,40.036311 -118.298157,40.235316
      -114.348386,40.631532 -112.670431,40.761033
      -111.916045,40.681939 -110.177711,40.653055
      -109.544331,40.619327 -107.155697,40.642007
      -105.410526,40.421505 -103.192299,40.430138
      -102.853712,40.427904 -98.168302,40.363524
      -97.093391,40.308754 -94.831304,40.479175
      -93.760070,40.395392 -84.913828,39.466651
      -84.414888,39.387332 -81.380660,39.188551
      -80.276261,38.977744 -77.811560,38.872542
      -75.062267,38.521146 -72.006956,38.101733
Can I draw a circle in KML?

There is no Circle geometry in KML, however you can create something very close to circles using LineStrings with many close together coordinates. Here's an example.

Can I change a LineString to be dashed or have arrows?

<LineStyle> allows you to change the color, opacity, and size of the lines. However, at this point, KML does not support changing the types of lines in KML.

How do I hide the labels of Placemarks?

The label that shows up next to a Placemark in Google Earth is based on the <name> element. Setting the scale element in LabelStyle to 0, you can hide the label.

<Style id="hideLabel">
Why am I getting a parse error?

There are two main causes for parse errors:

  1. Letter Case: KML, like all XML languages, is case sensitive. It requires that all the element names be in the correct case. For instance: <Placemark> not <PLACEMARK> <href> not <Href> <Link> not <lInk>
  2. Incomplete tags: All elements must start and end with the same tag. Sometimes people forget to close a tag, or leave off an angle bracket (< or >)

    For instance:
    <name>Atlanta</name> is correct
    <name>Atlanta is not correct
    <nameAtlanta</name> is not correct
    <nameAtlanta<name> is not correct

How do I know if a KML file I wrote is a valid KML file?

KML is an XML markup language. You can validate it in one of a variety of ways:

  • You can get an XML editor, such as Oxygen or Netbeans and use those to validate the document. Check the documentation for the XML editor of your choice. You will need the KML schema to do validation.
  • You can check it using an online validator, such as, or Galdos' KML Validator, which will show you any errors you made and offer a few style suggestions as well.
  • Some text editors allow you to do XML validation. For instance, you can use jEdit to validate your KML. Check out this tutorial from the Google Earth Outreach team.
Is there a way to control what appears on the screen, so that more details are shown when the user is closer to the Earth's surface?

The Region tag is used to control what features you are displaying to the user. The best resources for finding out more information on regions are

Can I assign different colors/styles to different geometries in a MultiGeometry element?

The MultiGeometry element groups geometries together in the same Placemark element. This allows the geometries to share the same styling and to appear as one item in a list such as the My Places pane in Google Earth.

Styles are set at the Placemark level, either using a styleUrl element or a Style element. Therefore, individual geometries in that Placemark cannot have different styles.

A frequently used workaround is to create a separate Placemark for each geometry, allowing each one to have a different style. To prevent a proliferation of items in a list, place them in a Folder that has a ListStyle with a listItemType with checkHideChildren. In Google Earth, for instance, this places all the Placemarks in the same folder element in My Places, and prevents the user from opening it up to display a large number of elements.

Can I have a balloon open when I open a KML file?

At this point, KML does not support the ability to open a balloon when the KML file opens. However, if you use a feature anchor, you can create a link in a balloon that will open a second KML file or a different balloon.

Can I keep a balloon open when a NetworkLink refreshes?

At this point, KML does not support preserving balloon status when the NetworkLink refreshes.

Can I view KML created by my users?

At this point you cannot use a NetworkLink to capture KML created by a user in Google Earth or Maps. You could use the Google Maps JavaScript API as a KML creation tool, however, and capture that information back to the server. For an example, see GeoDataStore.

Can I control the time slider from KML?

The time slider in KML opens as soon as a KML file with a TimeStamp or TimeSpan element is opened. The time slider finds all currently selected TimeStamp and TimeSpan elements and adjusts to accomodate all dates represented. KML currently does not allow more control over the time slider, such as setting the current time selected, or selecting how wide a time span is represented. For more information on using Time, check out the article Time and Animation.

How do I build in interactivity to KML? Can I put Forms into the HTML in KML description balloons?

At this point, KML in Google Earth only supports a subset of HTML that describes presentation, not interaction.

You can, however, build Flash forms into KML used in Google Earth. To do this, embed a Flash application into the HTML in a KML description balloon.

Can I create KML automatically from a Spreadsheet?

There are a few basic ways of doing this.

  • Do it programmatically yourself, using your own application to parse a CSV file and create KML out of it. For an example, check out Converting CSV files to KML.
  • Use an online spreadsheet. For instance, the Google Earth Outreach team has created a Spreadsheet Mapper based on Google Spreadsheets.
  • Use one of the Excel to KML creation tools, such as [link to tek's thread]this one
  • Use Google Earth Plus or Pro to load the files and then save them as KML or KMZ files
Why won't my KML files download correctly from my web server?

Web servers have to be told what kinds of files they are providing. Some browsers, such as Firefox, will make guesses on the file type. Others, such as Internet Explorer, rely on the web server's MIME Type settings.

For an Apache server, you would include these two lines in httpd.conf:

AddType application/ .kml
AddType application/ .kmz

For Microsoft's Internet Information Server, you would follow these directions:

IIS Version 6.0:

IIS 4.0 and 5.0:

If you manage your own web server, you must change your own configuration. Otherwise, contact your web site hosting service and ask them to make these changes.

Why does my balloon content say it may be using incorrectly formatted image URLs?

A recent change in Google Earth changes the way links are processed for content inside a feature balloon to make previously unspecified behavior more clear. As a result, clicking a link from within a KMZ that has an invalid link structure will take users to a page stating "The link that sent you here may be formatted incorrectly. Click on the link below to try using legacy mode." If you see this message, you should change the structure of your KML/KMZ content to ensure full compatibility with future versions of Google earth.

See this article for more information, including details on how to appropriately restructure your KMZ content.

What content is affected by new relative path rules?

Currently, only links (URL's) within feature balloon content is affected by this change. This includes <description> and <text> tags inside <BallonStyles>s. However future versions of Google Earth may move towards further consistency, so using the parent directory as the base URL for a relative link in KMZ content should always be avoided.

Is KML in Google Earth's My Places sent to Google's servers?

No. KML created in Google Earth or loaded in Google Earth by the user is not sent to Google. All processing and storing of that data is done on the local machine.

Back to top