Load a kml file periodically to update position in google earth

kml
Maysam picture Maysam · May 24, 2011 · Viewed 11.7k times · Source

I want to load a kml file every 10 seconds with google earth, I found this example http://ukhas.org.uk/code:kml_live_update but it seems it does not work.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
  <NetworkLink>
    <Link>
      <href>every10.kml</href>
      <refreshMode>onInterval</refreshMode>
    <refreshInterval>10</refreshInterval>
    </Link>
  </NetworkLink>
</Document>
</kml>

It does not load every10.kml, even I tried a kml file over internet (http://code.google.com/apis/kml/documentation/Point.kml )

Answer

arboc7 picture arboc7 · May 26, 2011

The code you provided from the example is valid, but the link reference (href) is incorrect. You should try inserting a full URL, and it will work. Using the Point.kml file you provided, the working code should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
  <NetworkLink>
    <Link>
      <href>http://code.google.com/apis/kml/documentation/Point.kml</href>
      <refreshMode>onInterval</refreshMode>
      <refreshInterval>10</refreshInterval>
    </Link>
  </NetworkLink>
</Document>
</kml>