Keyhole Markup LanguageKMLKMZGIS file formatGoogle Earth

Keyhole Markup Language (KML): The Standard for Geographic Visualization

Keyhole Markup Language (KML) Keyhole Markup Language (KML) is a specialized XML (Extensible Markup Language) notation used to express geographic annotations and visualizations. It allows...

Keyhole Markup Language (KML)

Keyhole Markup Language (KML) is a specialized XML (Extensible Markup Language) notation used to express geographic annotations and visualizations. It allows users to display data on two-dimensional maps and within three-dimensional Earth browsers, making complex geospatial data accessible and visual.

Originally developed by Keyhole, Inc. for the Keyhole Earth Viewer, the format became central to Google Earth after Google acquired Keyhole, Inc. in 2004. While Google Earth was the first application capable of viewing and graphically editing these files, KML has since evolved into a widely supported format used by various Geographic Information System (GIS) software applications, including QGIS, ArcGIS, and Marble.

ไม่มีภาพประกอบ

Key Facts

  • Developer: Created by Keyhole, Inc. and later developed by Google.
  • Standardization: Became an international standard of the Open Geospatial Consortium (OGC) in 2008.
  • File Extensions: Uses .kml for plain text and .kmz for compressed archives.
  • Coordinate System: Based on the World Geodetic System of 1984 (WGS84).
  • Compatibility: Supported by major GIS tools like ArcGIS, QGIS, and Marble.

KML Structure and Features

A KML file defines a variety of features that can be rendered in geospatial software. These include placemarks, polygons, images, 3D models, and textual descriptions. To position these elements, every place is assigned a longitude and a latitude.

To create a more immersive "camera view," KML can include additional data such as altitude, heading, and tilt, as well as timestamps or timespans for temporal data. The structural grammar of KML is similar to that of the Geography Markup Language (GML). It is important to note that some KML information may not be compatible with Google Maps or mobile versions of the software.

KML vs. KMZ

While .kml files are plain text, they are frequently distributed as KMZ files. A KMZ file is essentially a zipped KML archive. This format is used to bundle the root KML document (conventionally named "doc.kml") with necessary supporting assets, such as:

  • Overlay images and icons.
  • COLLADA 3D models.
  • Network-linked KML files.

In a KMZ structure, the root KML document resides at the top directory level, while referenced assets are typically organized into subdirectories.

Geodetic Reference Systems

KML utilizes 3D geographic coordinates ordered as longitude, latitude, and altitude. The system uses decimal degrees and follows the World Geodetic System of 1984 (WGS84). In this system, negative values represent West (longitude), South (latitude), and elevations below mean sea level (altitude).

Altitude is measured in meters relative to the WGS84 EGM96 Geoid vertical datum. If the altitude is omitted from a coordinate string—for example, (-77.03647, 38.89763)—the system assumes a default value of 0, which approximately corresponds to sea level.

The OGC Standardization Process

To ensure KML remained an open standard for all geobrowsers, the KML 2.2 specification was submitted to the Open Geospatial Consortium (OGC). A dedicated Standards Working Group was established in November 2007, and after a period of public comment, KML 2.2 became an official OGC standard on April 14, 2008.

The working group continued to refine the format, incorporating change requests to develop the KML 2.3 standard, which was officially published on August 4, 2015.

Feature KML KMZ
Extension .kml .kmz
Format XML (Plain Text) Zipped Archive
MIME Type application/vnd.google-earth.kml+xml application/vnd.google-earth.kmz
Contents Geographic data/annotations KML doc + images, icons, 3D models

Frequently Asked Questions

What is the difference between KML and KMZ?

KML is a plain text XML file containing geographic data. KMZ is a compressed (zipped) version of a KML file that can also include bundled resources like images and 3D models.

Which coordinate system does KML use?

KML uses the World Geodetic System of 1984 (WGS84) for longitude and latitude, and the WGS84 EGM96 Geoid vertical datum for altitude.

Can KML files be used in software other than Google Earth?

Yes. Because it is an OGC international standard, KML is supported by many GIS applications, including QGIS, ArcGIS, and Marble.

What happens if altitude is not specified in a KML coordinate?

If the altitude component is missing from the coordinate string, the software assumes a default value of 0, which is approximately sea level.

Who manages the current KML standards?

The Open Geospatial Consortium (OGC) manages the standards, having formalized KML 2.2 in 2008 and KML 2.3 in 2015.