Language selection

Search


Keyhole Markup Language (KML)

Overview

KML is an XML language for expressing geographic annotation and visualization within Internet-based, two-dimensional maps and three-dimensional Earth browsers.  Geographic visualization, including annotation of maps and images, provides not only the presentation of graphical data on the globe, but also the control of the user's navigation in the sense of where to go and where to look.

From this perspective, KML is complementary to most of the key existing standards such as Geography Markup Language (GML), Web Feature Service (WFS) and Web Map Service (WMS). KML 2.2 uses certain geometry elements derived from GML 2.1.2, including point, line string, linear ring, and polygon.

The KML community is wide and varied. Casual users create KML placemarks to identify their homes, describe journeys, and 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. Many organizations (such as government departments, private sector firms, academia and international agencies) have used KML to display their own rich sets of global data.

Additional Information

Standard:     

OGC® KML

Related Information

Geography Markup Language (GML)

Web Feature Service (WFS)

Web Map Service (WMS)

Notes

Google originally submitted KML to the OGC® to allow KML to evolve within the OGC consensus process. KML version 2.2 was adopted in 2008 as an OGC® implementation standard.

Future versions of the KML implementation standard may be further harmonized with GML (e.g. to use the same geometry representation) and other relevant OGC® standards.

Additional Information: Keyhole Markup Language (KML)

Background

KML Files

Background

Keyhole Markup Language(KML) was developed for use with Google Earth, which was originally named Keyhole Earth Viewer. It was created by Keyhole, Inc., which was acquired by Google in 2004. Google Earth was the first program able to view and graphically edit KML files. The name "Keyhole" pays homage to the KH reconnaissance satellites, the original eye-in-the-sky US military reconnaissance system first launched in 1976.

Google submitted KML to the OGC® to be evolved within the OGC®  consensus process, andto assure its status as an open standard for all geobrowsers. In November 2007 a new KML 2.2 Standards Working Group was established within the OGC®, to formalize KML 2.2 as an OGC®  standard. Comments were sought on the proposed standard until January 2008, and it became an official OGC® standard in April 2008. Future versions may be harmonized with relevant OGC® standards, which will encourage broader implementation and greater interoperability and sharing of earth browser content and context. The Mass Market Geo Working Group (MMWG) in the OGC®  will establish such additional harmonization activities, with Geography Markup Language (GML), possibly Styled Layer Descriptor (SLD) and others. There are four objectives for this standards and harmonization work:

  • Creating one international standard language for expressing geographic annotation and visualization on existing or future web-based online and mobile maps (2D) and earth browsers (3D);
  • Aligning KML with international best practices and standards, thereby enabling greater uptake and interoperability of earth browser implementations;
  • Using a collaborative approach will ensure that the KML implementer community is properly engaged in the process, and that the KML community is kept informed of progress and issues; and
  • Applying the OGC® process to ensure proper life-cycle management of the KML standard, including such issues as backwards compatibility.

KML Files

KML is an XML grammar used to encode and transport representations of geographic data for display in an earth browser. Put simply: KML encodes what to show in an earth browser, and how to show it. Like HTML, KML uses a tag-based structure with nested elements, names and attributes used for specific display purposes. KML can be used to:

  • Annotate the Earth;
  • Specify icons and labels to identify locations on the surface of the Earth;
  • Create different camera positions to define unique views for KML features;
  • Define image overlays to attach to the ground or screen;
  • Define styles to specify KML feature appearance;
  • Write HTML descriptions of KML features, including hyperlinks and embedded images;
  • Organize KML features into hierarchies;
  • Locate and update retrieved KML documents from local or remote network locations;
  • Define the location and orientation of textured 3D objects

A KML file specifies a set of features (placemarks, images, polygons, 3D models, textual descriptions, etc.) for display in any 3D Earth browser (geobrowser) implementing the KML encoding. Each place always has a longitude and latitude. Other data can make the view more specific, such as tilt, heading, altitude, which together define a "camera view". KML shares some of the same structural grammar as GML.

For its reference system, KML uses 3D geographic coordinates: longitude, latitude and altitude, in that order. The longitude and latitude components are as defined by the World Geodetic System of 1984 (WGS-84). The vertical component (altitude) is measured from the WGS84 EGM96 Geoid vertical datum. If altitude is omitted from a coordinate string, e.g. (-122.917, 49.2623) then the default value of 0 (approximately sea level) is assumed for the altitude component, i.e. (-122.917, 49.2623, 0) is assumed. A formal definition of the coordinate reference system used by KML (encoded as GML) is contained in the OGC® KML 2.2 specification.

KML files are very often distributed in KMZ files, which are zipped files with a “.kmz” extension. These must be legacy (ZIP 2.0) compression compatible (i.e. deflate method); otherwise the KMZ file might not uncompress in all geobrowsers. The contents of a KMZ file are a single root KML document (notionally "doc.kml") and optionally any overlays, images, icons, and 3D models referenced in the KML including network-linked KML files. The root KML document is typically a file named "doc.kml" at the root directory level but the first .kml file entry in the KMZ file is the actual one selected, regardless of its name. By convention the root KML document is at root level and referenced files are in subdirectories (e.g. images for overlay images).

Page details

Date modified: