Search code examples
kmlgoogle-earth

Can I set the altitude mode or extrude globally (only once)?


I want to use extrude/altitude absolute on my points. I can do this as below, but then I have to repeat this for every point (larger kml file).

Wonder if I can set this globally and only once? As a kind of default value for <Point>.

<Placemark><Point><altitudeMode>absolute</altitudeMode><extrude>1</extrude><coordinates>9.38916000,49.83081000,8457.590000</coordinates></Point><name>1: 18:53:29.477 </name> .... </Placemark>

Solution

  • The properties extrude and altitudeMode are only defined in the context of a given geometry and KML does not provide a global setting that can be defined globally and inherited.

    One option to make the KML file size smaller is add the KML file to a KMZ file so the file is compressed.

    KML has the concept of inheritance and reuse to eliminate redundant elements as the following:

    1. shared styles

    KML has the concept of shared styles that can be defined once and reused in muiltiple placemark. The styles are global and it be referenced anywhere in the KML file by its "id".

    2. inheritance

    For convenience in constructing KML feature hierarchies the value of the following four elements are inherited by all Placemark, Folder, and Document members of a feature hierarchy. For more details see KML 2.2 Standard (section 9.6.2).

    • atom:author
    • atom:link
    • kml:Region
    • kml:AbstractTimePrimitiveGroup (e.g., TimeSpan or TimeStamp)

    For example, if a Document or Folder has a Region element then that Region applies to all child Documents, Folders, and Placemarks unless the child explicitly defines its own region.