Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load a kml file periodically to update position in google earth

Tags:

kml

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 )

like image 298
Maysam Avatar asked May 24 '11 10:05

Maysam


2 Answers

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>
like image 188
arboc7 Avatar answered Jan 03 '23 15:01

arboc7


First - it is working example. You must specify full link to your kml file. In my version GE this NetworkLink update every 10 sec. In your case, for refresh view (and new update kml), you may try to setup settings in Google Earth. On context menu on subelement of kml file (NetFolder icon), you may choose Refresh tab (maybe other name - i have language differen from English) and choose 10 sec interval.

like image 42
Chiffa Avatar answered Jan 03 '23 14:01

Chiffa