Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It loads as an absolute everytime so terrain must be turned off to see the lines. Any idea how to get it so they default to clamped to ground? Using newest version of GE.

share|improve this question

The Google Earth help discusses the different options for toggling this setting within Google Earth, however none have the permanence that you need.

If you just have a small number of KML files to alter you could simply edit them in a text editor using search and replace to replace the line <altitudeMode>absolute</altitudeMode> with <altitudeMode>clampToGround</altitudeMode> for each geometry. This will permanently alter the files so they always load with the desired altitude settings. Full details on this tag are listed in the KML reference.

If you have many files to do, or will perform the operation many times you may find it better to modify your KML files using python to perform the find and replace across may files automatically. I recently wrote a simple regular expression to perform a similar task which I have modified for this problem:

import re

#load file into memory
with open('input_file.kml','r') as kml:
    lines = kml.readlines()

#search and replace throughout the file in memory
for i,line in enumerate(lines):
        lines[i] = '<altitudeMode>absolute</altitudeMode>\n'

#write file from memory
with open('input_file.kml','w') as kml:
    for line in lines:

This will replace any altitude settings with your desired settings, and could be nested within a loop to iterate though a folder full of KML files, if needed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.