Altitude Modes

Many KML features can contain an <altitude> element or coordinate, which specifies a distance above the ground level, sea level, or sea floor for that particular feature. <AbstractView> elements also can contain altitude.

Any altitude value should be accompanied by an <altitudeMode> element, which tells Google Earth how to read the altitude value. Altitudes can be measured:

from the surface of the Earth (relativeToGround),

above sea level (absolute), or

from the bottom of major bodies of water (relativeToSeaFloor).

It can also be ignored (clampToGround and clampToSeaFloor)

SeaFloor altitude modes and the KML extension namespace

Sea floor-related altitude modes are contained within a set of extensions to the KML standard, using the gx prefix. To use them, you must first add the correct namespace URI to the opening <kml> element in your KML file:

Altitude mode reference

absolute

The absolute altitude mode measures altitude relative to sea level, regardless of the actual elevation of the terrain beneath the feature. In this way, features can be placed underground, and will not be visible. Portions of a feature can extend underground, as in the example below. Negative values are accepted, to place features below sea level.

This altitude mode is useful in situations where the altitude value is known precisely. GPS tracks, for example, can use the absolute altitude mode to display paths created while flying or diving.

clampToGround

This mode ignores any altitude value, and places the KML feature on the surface of the ground, following the terrain. In this way, GroundOverlays can, for example, be 'draped' over the surface of the Earth. If the feature is positioned over a major body of water, clampToGround will place the feature at sea level.

Any KML feature with no altitude mode specified will default to clampToGround.

clampToSeaFloor

As with clampToGround, this mode ignores the altitude value. It places the feature on the bottom of any major body of water; if the feature is located away from a body of water, the feature will be clamped to the ground level, instead.

relativeToGround

Measures the altitude from the ground level directly below the coordinates.

As an example, this altitude mode can be used to place the tops of powerline poles as they climb up and over a hill. If each pole is 20m tall, the location of each pole's top will move up and down with the elevation of the Earth.