Yes, this is possible - see "Network Links" in the KML Tutorial and the rest of the KML docs. Here is a really simple proof-of-concept, open the generated main.kml and you should see the point hopping around the map while the script runs. This script is far from optimal, for example you should use a proper templating engine (e.g. Template) or XML::LibXML to generate the XML instead of the way I'm doing it here (regexes). You can control and adjust a lot of things in Google Earth using KML, it's too much to cover here, so see their documentation. I'm using my module File::Replace to help prevent Earth from reading the XML file while the script is writing it.

use warnings; use 5.014; # for s///r use File::Replace qw/replace3/; use utf8; my $mainkml = 'main.kml'; my $dynkml = 'dyn.kml'; open my $fh1, '>:encoding(UTF-8)', $mainkml or die "$mainkml: $!"; print $fh1 <<'END_KML1' =~ s/__FILENAME__/$dynkml/r; <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Folder> <name>Network Links</name> <visibility>0</visibility> <open>0</open> <NetworkLink> <name>Random Placemark</name> <refreshVisibility>0</refreshVisibility> <visibility>1</visibility> <open>1</open> <flyToView>1</flyToView> <Link> <refreshInterval>2</refreshInterval> <refreshMode>onInterval</refreshMode> <href>__FILENAME__</href> </Link> </NetworkLink> </Folder> </kml> END_KML1 close $fh1; print "Please open '$mainkml' in Google Earth\n"; my $run = 1; $SIG{INT} = sub { $run=0 }; my ($lat,$lon) = (52.514509,13.350103); while ($run) { my (undef,$outfh,$repl) = replace3($dynkml, ':encoding(UTF-8)'); print $outfh <<'END_KML2' =~ s/__LONLAT__/sprintf('%.6f,%.6f',$lon +,$lat)/er; <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Placemark> <name>Random Placemark</name> <description>Hello, World!</description> <Point> <coordinates>__LONLAT__</coordinates> </Point> </Placemark> </kml> END_KML2 $repl->finish; sleep 1; $lat += (rand(2)-1)/1000; $lon += (rand(2)-1)/1000; }

In reply to Re: interactive google earth access by haukex
in thread interactive google earth access by Tsunami perl user

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.