KML 2.2 is the OGC standard 07-147r2, namespace
http://www.opengis.net/kml/2.2. This page follows its XML Schema,
ogckml22.xsd,
read 2026-11-13. Elements are grouped by the abstract types they derive from, and
child elements appear in a fixed order. Google’s gx: extensions are a
separate schema, not covered here.
Features
Every feature can have: name, visibility (0 or 1),
open, atom:author, atom:link,
address, xal:AddressDetails, phoneNumber,
Snippet (or the older snippet), description,
a view, a time primitive, styleUrl, inline styles, a
Region, Metadata (deprecated) and
ExtendedData.
| Element | Kind | Own children |
|---|---|---|
Document | Container | Schema definitions, then features. Shared styles live here. |
Folder | Container | Features. |
Placemark | Feature | One geometry. |
NetworkLink | Feature | refreshVisibility, flyToView, Link (or the older Url): loads more KML from a URL. |
GroundOverlay | Overlay | altitude, altitudeMode, LatLonBox (north, south, east, west, rotation). |
ScreenOverlay | Overlay | overlayXY, screenXY, rotationXY, size, rotation. |
PhotoOverlay | Overlay | rotation, ViewVolume, ImagePyramid, Point, shape. |
Overlays share color, drawOrder and Icon.
Geometries
| Element | Children |
|---|---|
Point | extrude, altitudeMode, coordinates (one tuple). |
LineString | extrude, tessellate, altitudeMode, coordinates. |
LinearRing | As LineString; closed: first and last tuple the same, at least four. |
Polygon | extrude, tessellate, altitudeMode, outerBoundaryIs (one LinearRing), innerBoundaryIs (holes). |
MultiGeometry | Any geometries. |
Model | altitudeMode, Location, Orientation (heading, tilt, roll), Scale, Link to the model file, ResourceMap. |
coordinates holds tuples longitude,latitude[,altitude]
separated by white space, in WGS 84 degrees and metres.
Styles
StyleholdsIconStyle(scale,heading,Icon,hotSpot),LabelStyle(scale),LineStyle(width),PolyStyle(fill,outline),BalloonStyle(bgColor,textColor,text,displayMode) andListStyle(listItemType,bgColor,ItemIcon,maxSnippetLines).- The colour styles share
colorandcolorMode. Colours are 8 hex digits in the order alpha, blue, green, red:ff0000ffis opaque red. StyleMapholdsPairs ofkey(normalorhighlight) and a style orstyleUrl.
Views, time, regions and data
| Element | Children |
|---|---|
LookAt | longitude, latitude, altitude, heading, tilt, range, altitudeMode. |
Camera | longitude, latitude, altitude, heading, tilt, roll, altitudeMode. |
TimeStamp | when: an XML Schema date or time, as precise as needed (1997, 1997-07, 1997-07-16T07:30:15Z). |
TimeSpan | begin, end. |
Region | LatLonAltBox (north, south, east, west, minAltitude, maxAltitude, altitudeMode) and Lod (minLodPixels, maxLodPixels, minFadeExtent, maxFadeExtent). |
Link, Icon | href, refreshMode, refreshInterval, viewRefreshMode, viewRefreshTime, viewBoundScale, viewFormat, httpQuery. |
ExtendedData | Data (@name; displayName, value), SchemaData (@schemaUrl; SimpleData @name) or elements of other namespaces. |
Schema | @name; SimpleField (@type, @name; displayName). |
NetworkLinkControl | Top level, for files loaded by network links: minRefreshPeriod, maxSessionLength, cookie, message, linkName, linkDescription, linkSnippet, expires, Update (with targetHref and Create, Delete, Change), a view. |
Enumerations
| Element | Values |
|---|---|
altitudeMode | clampToGround (default), relativeToGround, absolute. |
colorMode | normal, random. |
refreshMode | onChange, onInterval, onExpire. |
viewRefreshMode | never, onStop, onRequest, onRegion. |
listItemType | check, checkOffOnly, checkHideChildren, radioFolder. |
displayMode | default, hide. |
key (StyleMap) | normal (default), highlight. |
state (ItemIcon) | A space-separated list of open, closed, error, fetching0, fetching1, fetching2. |
shape (PhotoOverlay) | rectangle, cylinder, sphere. |
gridOrigin (ImagePyramid) | lowerLeft, upperLeft. |
Units of hotSpot, overlayXY and the like | fraction, pixels, insetPixels. |
Elements listed above only by name, and extension points
Alias(child ofResourceMap):targetHrefthensourceHref, both optional.ViewVolume(of a PhotoOverlay):leftFov,rightFov,bottomFov,topFovandnear, in that order.ImagePyramid:tileSize,maxWidth,maxHeight,gridOrigin.Location(of a Model):longitude,latitude,altitude.Orientation:heading,tilt,roll.Scale:x,y,z.- Every object (
AbstractObjectType) may carry the attributesid(XML ID) andtargetId(NCName, used byUpdate).Snippethas the attributemaxLines(int, default 2). - The vector type used by
hotSpot,overlayXY,screenXY,rotationXYandsizehas the attributesxandy(double, default 1.0) andxunitsandyunits(fraction,pixelsorinsetPixels, defaultfraction). - Every element type ends with optional, repeatable extension groups, a simple one (
…SimpleExtensionGroup, any simple type) and an object one (…ObjectExtensionGroup, substitutable for an object), which is how vendor schemas such asgx:add elements.
Value types
| Type | Meaning |
|---|---|
angle90 | double, −90 to 90 (latitudes, bottomFov, topFov); anglepos90 is 0 to 90. |
angle180 | double, −180 to 180 (longitudes, leftFov, rightFov, roll, rotation, the box edges); anglepos180 is 0 to 180 (tilt). |
angle360 | double, −360 to 360 (heading). |
color | 4 bytes as hexBinary, aabbggrr. |
dateTime | XML Schema dateTime, date, gYearMonth or gYear. |
coordinates | A list of strings (the tuples). |
Default values in the schema
From the default attributes of ogckml22.xsd:
| Element | Default | Element | Default |
|---|---|---|---|
visibility | 1 | open | 0 |
extrude | 0 | tessellate | 0 |
altitude, minAltitude, maxAltitude | 0.0 | altitudeMode | clampToGround |
fill, outline | 1 | scale, x, y, z, width, viewBoundScale | 1.0 |
color, bgColor | ffffffff | textColor | ff000000 |
colorMode | normal | displayMode | default |
listItemType | check | key | normal |
refreshMode | onChange | viewRefreshMode | never |
refreshInterval, viewRefreshTime | 4.0 | minRefreshPeriod | 0.0 |
maxSessionLength | −1.0 | refreshVisibility, flyToView | 0 |
drawOrder | 0 | maxSnippetLines, Snippet’s maxLines | 2 |
minLodPixels, minFadeExtent, maxFadeExtent | 0.0 | maxLodPixels | −1.0 |
tileSize | 256 | maxWidth, maxHeight | 0 |
gridOrigin | lowerLeft | shape | rectangle |
longitude, latitude, heading, roll, rotation, tilt, range, near | 0.0 | leftFov, rightFov, bottomFov, topFov | 0.0 |
north, east | 180.0 | south, west | −180.0 |
These are the schema’s defaults, which describe what an absent element means to a validating reader; they are not all the same as Google’s documented behaviour for every element.
KMZ
Google’s KMZ
archives guide (read 2026-11-12) describes a .kmz file as a main KML
file and zero or more supporting files packed with a
ZIP utility. By default the main file is named
doc.kml; the guide says to put only one .kml file at the
top level, because Google Earth uses the first one it finds and ignores the rest.
Relative URLs inside it are resolved against the folder holding the main file, the
root of the archive.