I'm trying to cause the Google Earth camera to fly to a particular position using a Perl script, but my attempts to alter the camera settings are running into a problem. The following code fails
use warnings; use strict; use Win32::OLE; my $GE = Win32::OLE->new('GoogleEarth.ApplicationGE'); my $cameraInfo = $GE->GetCamera(0); $cameraInfo->Range = 500;
with the error "Can't modify non-lvalue subroutine call at GE.pl line 6." Ok, so maybe I need to treat it as a function call, so I tried
use warnings; use strict; use Win32::OLE; my $GE = Win32::OLE->new('GoogleEarth.ApplicationGE'); my $cameraInfo = $GE->GetCamera(0); $cameraInfo->Range(500);
and got the error "Win32::OLE(0.1707) error 0x80020011: "Does not support a collection" in METHOD/PROPERTYGET "Range" at GE.pl line 6" As I understand it, this means there's something wrong with the argument type, so I tried variations on the argument like '500'. No luck. I can read the parameters fine, such as
print $cameraInfo->Range;
which yields the expected result. Can anyone tell me what I'm doing wrong here? If it helps, when I run the following:
use warnings; use strict; use Win32::OLE; use Data::Dumper; my $GE = Win32::OLE->new('GoogleEarth.ApplicationGE'); my $cameraInfo = $GE->GetCamera(0); print Dumper($cameraInfo);
I get this:
$VAR1 = bless( { 'FocusPointLatitude' => '38.9594283106337', 'FocusPointLongitude' => '-95.2654992558942', 'FocusPointAltitude' => '0', 'FocusPointAltitudeMode' => 2, 'Range' => '11110155.9149248', 'Tilt' => '0', 'Azimuth' => '-1.00991539999065e-005' }, 'Win32::OLE' );

In reply to Controlling Google Earth via COM interface by jjorsett

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.