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. 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).
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.
There are three main tools for creating KML files.
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.
There are also many tools created by users in the Google Earth community. Check out the KML Developer Support Google Group.
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.
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.
All KML tags are supported by Google Earth. For a list of all tags, see the KML Specification.
Google Maps supports a subset of KML tags. Check out the list here.
The Developer Guide can be found at http://code.google.com/apis/kml/documentation/topicsinkml.html.
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="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Untitled Path</name>
<LineString>
<tessellate>0</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>-115.415105,40.669016 -37.752364,34.879979</coordinates>
</LineString>
</Placemark>
</kml>
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.
<Placemark>
<name>Untitled Path</name>
<LineString>
<tessellate>1</tessellate>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>
-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
-66.67819,37.664687
</coordinates>
</LineString>
</Placemark>
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.
<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.
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">
<LabelStyle>
<scale>0</scale>
</LabelStyle>
</Style>
There are two main causes for parse errors:
KML is an XML markup language. You can validate it in one of a variety of ways:
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
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.
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.
At this point, KML does not support preserving balloon status when the NetworkLink refreshes.
At this point you cannot use a NetworkLink to capture KML created by a user in Google Earth or Maps. You could use the Earth API or the Google Maps API as a KML creation tool, however, and capture that information back to the server. For an example, see GeoDataStore.
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.
At this point, KML in Google Earth only supports a subset of HTML that describes presentation, not interaction. KML with forms will work in Google Maps.
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. These will not work in Google Maps.
Placemarks created in Google Earth or created as KML files are not automatically shared with the world. To share your KML content, post the KML on your website, and then create a Sitemap and submit it to Google. For more information, read Submit Your Geo Content to Google. Alternately, you can submit your KML to the Google Earth Community. Every few months, Google selects a subset from those files submitted and puts them in the default Google Community layer.
There are a few basic ways of doing this.
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:For Microsoft's Internet Information Server, you would follow these directions:
IIS Version 6.0:
http://support.microsoft.com/kb/326965IIS 4.0 and 5.0:
http://www.microsoft.com/technet/prodtechnol/windows2000serv/technologies/iis/maintain/featusability/mimeiis.mspxIf 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.
There are two methods basic methods for putitng a webcam in KML.
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.