The acronym for Keyhole Markup Language, KML is a widely-used XML format for describing geospatial data. Files of this type are typically denoted with a .kml extension (compressed files will have the extension .kmz). Though best known on the web for its integration with Google Maps and Google Earth, KML is also an open standard approved by the Open Geospatial Consortium, and can be exported from (and, to a lesser extent imported to) complex mapping software, such as ArcGIS.
What is it good for?
KML is well suited for both creating and “consuming” geographic information. On the creation side, it can be used both to generate outlines of geographic regions (such as states, countries, or custom areas) or identify individual points or locations. On the consumption side, data published by government and other organizations in .kml can be visualized and republished nearly instantly, which makes it especially useful in breaking news situations.
In addition to basic point and outline information, KML *can* (but needn’t) include elaborate style information, such as fill and line styles, location icons and additional data. Because of this, some KML may generate an informative, fully styled map, while other KML may simply describe a range of geographic areas or locations.
What does it look like?
As mentioned above, KML is a specification of XML, and so follows the same grammatical rules. You’ll notice that it actually has an “xml” type header. Coordinates in KML are of format: latitude, longitude, height
KML describing an individual point:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Placemark> <name>Simple placemark</name> <description>Attached to the ground. Intelligently places itself at the height of the underlying terrain.</description> <Point> <coordinates>-122.0822035425683,37.42228990140251,0</coordinates> </Point> </Placemark>
KML describing a simple polygon:
<Polygon> <outerBoundaryIs> <LinearRing> <coordinates> -91.853943,33.943816,0 -91.779785,33.877713,0 -91.689148,33.927864,0 -91.818237,33.980264,0 -91.853943,33.943816,0 </coordinates> </LinearyRing> </outerBoundaryIs> </Polygon>
How do I use it?
KML can be used effectively to create customized, interactive maps, as well as three-dimensional figures and extrusions (to represent buildings and other structures). ArcGIS can easily output KML from state, county, and country outlines – or any other geographic features that the system has on record. Many technologies – including Google Maps, Google Earth, OpenLayers, Google Fusion Tables, Leaflet and Carto – can can consume KML to visualize points, polygons and other map features. In most cases, this simply requires pointing the application to the desired KML file. For example, trying opening the following file in Google Earth: Sample KML
KML is also very useful for tracking weather events and breaking news. For example, the NOAA maps the water levels of U.S. rivers here. However, the KMZ for these locations, which is updated every 15 minutes, is available here. This makes possible a live-updated map such as this one.
Where can I find it?
National and international organizations release data in KML and KMZ formats, and it can also be produced through ArcGIS or even written by hand. As noted above, organizations like NOAA and Google often release urgent data in KML in part because it is so easily visualized by a wide variety of tools.
Issues & FAQs
KMZ is a compressed format of KML. While some programs (such as Google Earth) may automatically “unzip” this format and visualize the file contents, in many cases you will need to manually unzip the file using WinZip or some other software.
Also note that while ArcGIS can output high-quality KML, it is less good at consuming it – that is, converting styled KML to a parallel shapefile (.shp). This somewhat complicates the process of generating print-quality maps from online-data, as restyling the imported KML and data is usually required.