KML
By Google
KML, Keyhole Markup Language, is an XML-based format for representing geographic features and annotations, such as points, lines, polygons, and imagery overlays, on a map or virtual globe. It was developed for use with Google Earth and…
Definition
KML, Keyhole Markup Language, is an XML-based format for representing geographic features and annotations, such as points, lines, polygons, and imagery overlays, on a map or virtual globe. It was developed for use with Google Earth and later became an open standard for exchanging geographic visualization data between mapping applications. KML files describe not just raw geographic coordinates but also styling, camera viewpoints, and time-based animation of geographic data.
Overview
Displaying geographic data visually, complete with labels, custom icons, styled shapes, and specific camera angles, required a format that went beyond raw coordinate data used by geographic information systems. KML was created to describe not just where geographic features are, but how they should look and be presented within a 3D globe or map viewer, filling the gap between raw geospatial data and a polished visual presentation. Mechanically, a KML file is an XML document containing elements that define placemarks with associated points or shapes, styles controlling colors and icons, and optionally camera or timeline elements that control how a viewer navigates the data over space and time. Geographic coordinates within KML are expressed in longitude, latitude, and altitude, and features can be organized hierarchically into folders that a viewer application renders as toggleable layers. KML files are often distributed compressed as a KMZ archive, which bundles the XML with any referenced images or icons. KML differs from raw geographic data formats used in geographic information systems, such as those built around vector shapefiles or simpler coordinate lists, in that it bundles visual presentation directly into the data format rather than leaving styling entirely to a separate application. It differs from GeoJSON in that KML is XML-based and carries built-in support for 3D camera views, time animation, and rich styling, while GeoJSON is a lighter, JSON-based format more common in web mapping applications that don't need those presentation features. In practice, KML is used to share custom map overlays and points of interest for viewing in globe and mapping applications, to export geographic data from GIS tools for visual presentation, and to encode flight paths, tours, or time-animated geographic data for playback within a 3D viewer. Emergency response and environmental monitoring tools have also used it to visualize sensor or incident data geographically for stakeholders who need a visual map rather than raw data tables. Its main limitations are verbosity, since XML markup for even simple point data is heavier than more compact modern alternatives, and a narrower base of supporting software compared to the wider adoption of GeoJSON in contemporary web-based mapping. Teams building new web-first mapping applications commonly prefer GeoJSON for its simplicity and native JSON compatibility, while KML remains the practical choice specifically when a workflow already centers on Google Earth or another KML-native 3D viewer application. Converting between the two formats is common in practice, since many geospatial toolchains can export KML from data originally captured or processed in a simpler vector format, letting teams keep GeoJSON for processing while still producing a polished KML file for stakeholder-facing visualization.
Specification
- XML-based format for geographic points, lines, and polygons
- Built-in support for custom styling of map features
- Camera viewpoint and time-based animation elements
- Hierarchical folder organization for toggleable map layers
- Often distributed compressed as a KMZ archive
- Native format for Google Earth and compatible viewers