Skip to main content

XML format

KML

An OGC standard for geographic annotation: placemarks, geometry and styling.

KML describes features for display on a map — points, lines, polygons and the styles that render them. It became an OGC standard after originating in Google Earth, and the namespace reflects that transfer.

KMZ is a zipped KML plus its referenced assets, which is worth knowing before trying to parse one as XML.

Constraints that bite

  • Coordinates are longitude,latitude[,altitude] — the reverse of the usual lat/lon order.
  • A whole coordinate list lives in one whitespace-separated text node, not in child elements.
  • KMZ is a ZIP archive; unpack it before XML processing.
  • Google's gx: extensions are not part of the OGC standard.
Root element
<kml>
Media type
application/vnd.google-earth.kml+xml
Extensions
.kml, .kmz
Namespaces
  • http://www.opengis.net/kml/2.2
XMLDir label
xml

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

kml.xml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Placemark>
    <name>Office</name>
    <Point><coordinates>21.0122,52.2297,0</coordinates></Point>
  </Placemark>
</kml>

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.