Take a Google Earth tour using Mac::Glue

brian_d_foy on 2007-01-26T06:50:49

Get a bird's eye view of all the Perl Mongers by using Mac::Glue to drive Google Earth:

#!/usr/bin/perl

use LWP::Simple; use Mac::Glue;

print "Downloading Perl Mongers XML file..."; my $data = get( 'http://www.pm.org/groups/perl_mongers.xml' ); $data ? ( print "done\n" ) : ( die "Could not get file!" );

# See Mac::Glue for details on creating the glue, probably: # gluemac /Applications/Google\ Earth.app print "Starting Google Earth..."; my $gEarth = Mac::Glue->new( 'Google_Earth' ); $gEarth ? ( print "done\n" ) : ( die "Could not start Google Earth!" );

while( $data =~ m|(.*?)|gs ) { # I could use an XML parser, but it's too easy to do it myself my( $name, $long, $lat ) = $1 =~ m| (.*?) .*? (.*?) .*? (.*?) |xs; print "Flying to $name\n"; $gEarth->setviewinfo( { 'azimuth' => '0', 'longitude' => $long, 'distance' => '4000', 'latitude' => $lat, 'tilt' => '0' } );

sleep 15; }


Way Cool

pudge on 2007-02-01T21:54:32

Would be better if Google Earth weren't so slow on my computer, but that's OK.