KML and KMZ Files: Google Earth Format Explained
KML (Keyhole Markup Language) is the XML format behind Google Earth. It was created by Keyhole, the company Google bought in 2004 to build Google Earth, and became an OGC standard in 2008. KML stores places, paths and areas together with their names, descriptions and styling.
KMZ is simply a ZIP-compressed KML file, often bundled with the icons and images it uses.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>Brandenburg Gate</name>
<description>Landmark in Berlin</description>
<ExtendedData>
<Data name="built"><value>1791</value></Data>
</ExtendedData>
<Point>
<coordinates>13.377704,52.516275,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>Convert KML / KMZ files
- Convert KML to GeoJSON— Convert a KML map file to GeoJSON
- Convert KML to Shapefile— Convert a Google Earth KML file to a Shapefile ZIP for QGIS and ArcGIS
- Convert KML to GPX— Convert a KML map file to a GPS track/route file
- Convert KML to KMZ— Compress a KML map file into a KMZ archive for Google Earth
- Convert KMZ to KML— Unzip a compressed KMZ map file to its underlying KML
- Convert KMZ to GeoJSON— Convert a compressed KMZ map file to GeoJSON
- Convert GeoJSON to KML— Convert a GeoJSON file to KML for Google Earth
- Convert GPX to KML— Convert a GPS track/route file to KML for Google Earth
- Convert GPX to KMZ— Convert a GPS track or waypoint file to a compressed KMZ for Google Earth
- Convert Shapefile to KML— Convert a Shapefile ZIP to KML for Google Earth
How a KML file is structured
Coordinates are always WGS 84 and written as longitude,latitude[,altitude], with longitude first. Swapping the order is the most common reason a hand-made KML shows up in the wrong place.
- Document and Folder: group placemarks, like folders in Google Earth's sidebar
- Placemark: one feature with a name, description and geometry
- Point, LineString and Polygon: the geometries; polygons have an outerBoundaryIs and optional innerBoundaryIs rings for holes
- MultiGeometry: several geometries in one placemark
- ExtendedData: custom attributes such as IDs or population
- Style: colors, line widths and icons
KML vs KMZ
A KMZ file is a ZIP archive containing a main file named doc.kml, plus any images or icons it references. It is smaller and keeps everything together, which makes it better for sharing. Google Earth and Google My Maps open both. To edit the contents, rename .kmz to .zip and extract it, or convert it to KML.
How to open a KML or KMZ file
- Google Earth Pro or Google Earth on the web: File → Open, or Projects → Import
- Google My Maps: Import into a layer
- QGIS and ArcGIS
- Any text editor, for KML
Frequently Asked Questions
- What is the difference between KML and KMZ?
- KMZ is a zipped KML file, optionally with images and icons. The map data is the same; KMZ is just smaller and self-contained.
- How do I use a KML file in QGIS or ArcGIS?
- Both can open KML directly. For editing or analysis, many GIS workflows convert KML to a shapefile or GeoJSON first, which keeps the attributes as regular table columns.