What Is Keyhole Markup Language (KML)?

Keyhole Markup Language (KML) is an XML-based file format used to represent and visualize geographic data in two-dimensional maps and three-dimensional Earth browsers. Originally developed by Keyhole, Inc. for use in its Earth Viewer software—which later became Google Earth—KML was adopted as an international open standard maintained by the Open Geospatial Consortium (OGC) in 2008. This article explains the fundamentals of the KML specification, how it utilizes XML to structure geographic features, its primary components, and its role in modern geographic information systems (GIS).

The Role of the Open Geospatial Consortium (OGC)

The Open Geospatial Consortium is an international standards organization that ensures geospatial content and services are interoperable across different platforms. When Google submitted KML version 2.2 to the OGC, the consortium established it as an official standard. Under OGC governance, KML specifications are maintained and evolved to ensure long-term compatibility, vendor neutrality, and seamless integration among diverse mapping software, mobile applications, and web services.

How KML Uses XML

KML is built entirely on the Extensible Markup Language (XML) standard, meaning all data is stored as human-readable, plain-text code using nested elements and tags. Each tag describes a specific geographical feature, attribute, or visual behavior.

A standard KML document begins with standard XML declaration headers and encloses all spatial data within a root <kml> element. Because it uses XML syntax, KML can be easily generated, parsed, edited, and validated using standard text editors and programming libraries.

Core Features and Elements in KML

The KML specification provides a wide variety of tags to describe spatial objects, styling, and navigation:

KML vs. KMZ

KML files are often distributed in a compressed format known as KMZ. A KMZ file is a standard ZIP archive containing a main doc.kml file along with any referenced local assets, such as custom icons, 3D model files (COLLADA format), and ground overlay textures. This packaging simplifies sharing, reduces file sizes, and ensures that all associated visual resources remain bundled together.

Practical Applications of KML

KML serves as a universal format for sharing geographic information across commercial and open-source platforms. Common uses include: