KML, Explained
iLoveConverter Team 2 min read
On this page
KML (Keyhole Markup Language) is Google Earth’s XML format for geographic visualization. Originally created by Keyhole Inc. (acquired by Google in 2004), it’s now an OGC standard. KML carries placemarks, paths, polygons, overlays, tours, folders, and network links — everything you need to describe a 3D geographic scene that renders in Google Earth, Google Maps, ArcGIS, and most other GIS tools.
Technical details
KML is XML that describes a hierarchy of features. <Placemark> wraps a <name>, <description>, and <Point>, <LineString>, or <Polygon> geometry. <Folder> and <Document> organize features into a tree. Styling happens via <Style> and <StyleMap> elements. <NetworkLink> lets KML reference remote content that refreshes. A .kmz file is a ZIP-compressed KML with embedded images and icons.
| Feature | KML | GeoJSON | Shapefile | GPX |
|---|---|---|---|---|
| Format | XML | JSON | Binary + DBF | XML |
| 3D support | Yes (altitude, tilt) | Limited | No | No |
| Styling | Rich XML styles | None | None | None |
| Size | Large (XML) | Medium | Small | Small |
| Standard | OGC | RFC 7946 | ESRI | GPX 1.1 |
| Ecosystem | Google Earth focus | Web GIS focus | Desktop GIS | GPS focus |
Conversion
KML ↔ GeoJSON is standard — both represent geographic features. Use ogr2ogr or Turf.js. KML → GeoJSON loses styling information and 3D altitude data. KML → CSV flattens placemark coordinates and properties into a spreadsheet. GeoJSON → KML gains the styling capability and 3D support that GeoJSON lacks.
Common problems
- XML verbosity. Large KML files become unwieldy — use KMZ compression.
- Style complexity.
<StyleMap>and cascading styles can be difficult to debug. - Version differences. KML 2.2 (OGC standard) and Google Earth’s KML extensions sometimes diverge.
FAQ
Can I open KML in Google Maps?
Yes — either drop it directly into Google Earth, upload to Google My Maps, or use the Google Maps JavaScript API’s Data layer which accepts KML URLs.
What’s the difference between KML and KMZ?
KML is the plain XML file. KMZ is a ZIP archive containing one KML file plus any embedded images, icons, or resources it references. KMZ is smaller and easier to share as a single file.
KML vs GeoJSON for web mapping?
GeoJSON wins for web APIs and data interchange — smaller, simpler, more JavaScript-friendly. KML wins when you need rich styling, 3D visualization, or Google Earth integration. Most platforms support both.
Does KML support altitude (3D)?
Yes — <Point> and <LineString> can have Z coordinates (lon, lat, alt) plus <altitudeMode> (absolute, relativeToGround, clampToGround). GeoJSON can encode altitude too, but Google Earth is where you see it rendered in 3D.
Can I convert KML to CSV for Excel?
Yes — ogr2ogr ogr2ogr -f CSV output.csv input.kml flattens the placemarks into rows with latitude, longitude, name, description columns.
Try it yourself — free, right in your browser
Everything mentioned in this guide runs locally on this site: no upload, no watermark, no sign-up.
Format deep-dives: KML (.kml) , GeoJSON (.geojson.json)