[OZAPRS] google_earth.cgi

Andrew Rich vk4tec at tech-software.net
Tue Dec 6 06:51:39 EST 2005


Ok here is the cgi that works

it is running on
http://vk4tec.no-ip.org/cgi-bin/google_earth.cgi?Call=<callsign>

#!/usr/bin/perl
use Net::Telnet;
#
# intregrate findu.com and google earth
# Andrew Rich VK4TEC December 2005
#
# Get the callsign from the URL
#
@pairs= split(/&/, $ENV{'QUERY_STRING'});
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# print $name."=".$value;
$FORM{$name} = $value;
# print $FORM{$name} ."=".$value;
}
#print $FORM{'Number'} ;
#print $FORM{'Date'};
$date = $FORM{'Date'};
$callsign = $FORM{'Call'};
#
# Connect to findu.com to get the lat and lon of the call provided
#
my $host = "www.findu.com";
my (@data, $line);
my $t = new Net::Telnet(Timeout=> '5', port => '80');
$t->errmode('return');
$t->Net::Telnet::open($host);
sleep 5;
print $t "GET /cgi-bin/posit.cgi?call=".$callsign."&comma=1\n";
while (<$t>)
{
if (m/,/)
{
@data = split/,/;
$long = $data[1];
$lat = $data[0];
}
}
$date = `date +%d/%m/%Y" "%H:%M`;
chop $date;
#
# Send back the kml that google earth needs
#
print ("Content-type: text/html\n\n");
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n";
print "<kml xmlns=\"http://earth.google.com/kml/2.0\"> \n";
print "<Placemark> \n";
print "<name>".$callsign."</name> \n";
print "<description>".$callsign." APRS </description> \n";
print "<LookAt>\n";
print "<longitude>".$long."</longitude>\n";
print "<latitude>".$lat."</latitude>\n";
print "<range>365.2646606980322</range>\n";
print "<heading>0</heading>\n";
print "<tilt>40</tilt>\n";
print "</LookAt>\n";
print
"<styleUrl>root://styleMaps#default+nicon=0x307+hicon=0x317</styleUrl>
\n";
print "<Style> \n";
print "<IconStyle> \n";
print "<Icon> \n";
print "<href>root://icons/palette-4.png</href> \n";
print "<x>192</x> \n";
print "<y>32</y> \n";
print "<w>32</w> \n";
print "<h>32</h> \n";
print "</Icon> \n";
print "</IconStyle> \n";
print "<LineStyle> \n";
print "<width>5</width>\n";
print "</LineStyle>\n";
print "</Style> \n";
print "<Point> \n";
print "<extrude>1</extrude>\n";
print "<altitudeMode>relativeToGround</altitudeMode>\n";
print "<coordinates>".$long.",".$lat.",50</coordinates> \n";
print "</Point> \n";
print "</Placemark> \n";
print "</kml> \n";
#
# End of file
#


-----------------------------------------
Andrew Rich - VK4TEC
vk4tec at tech-software.net
www.tech-software.net
Brisbane AUSTRALIA

  -----Original Message-----
  From: Andrew Rich [mailto:vk4tec at tech-software.net]
  Sent: Tuesday, 6 December 2005 5:22 AM
  To: steve at dimse.com
  Cc: TAPR List; VK Users
  Subject: findu.com and google earth proposal (feedback please)


  Steve,

  I am at the moment raiding findu.com to generate .kml files for the
google
earth application and then people raid my box.

  http://earth.google.com/download-earth.html (download site)

  Not web delivered dodgy'ed up maps, the google earth application which
is
free and auto tracks and zooms !!!!

  What I am proposing is this

  1) we make a cgi that can live on findu.com that generates a kml file on
demand so people can use the google earth application with findu.com
  2) you would then point you google earth application network link at
findu.com and ask it for the lastest position.

  We would then have satellite maps for all of the planet a one stop shop
!

  more detail can be seen here

  http://www.tech-software.net/globalearth.htm


  All we need to supply is the callsign, you supply us a location. Simple.

  I will even donate the cgi !! and notes for your web site

  findu.com/cgi-bin/google_earth.cgi&call=vk4tec-9

  What it needs to produce is this :-
  <?xml version="1.0" encoding="UTF-8"?>
  <kml xmlns="http://earth.google.com/kml/2.0">
  <Placemark>
  <name>VK4KHP-9</name>
  <description>VK4KHP-9 APRS </description>
  <LookAt>
  <longitude>152.59100</longitude>
  <latitude>-27.56300</latitude>
  <range>1000.2646606980322</range>
  <heading>0</heading>
  <tilt>40</tilt>
  </LookAt>
  <styleUrl>root://styleMaps#default+nicon=0x307+hicon=0x317</styleUrl>
  <Style>
  <IconStyle>
  <Icon>
  <href>root://icons/palette-4.png</href>
  <x>192</x>
  <y>32</y>
  <w>32</w>
  <h>32</h>
  </Icon>
  </IconStyle>
  <LineStyle>
  <width>5</width>
  </LineStyle>
  </Style>
  <Point>
  <extrude>1</extrude>
  <altitudeMode>relativeToGround</altitudeMode>
  <coordinates>152.59100,-27.56300,150</coordinates>
  </Point>
  </Placemark>
  </kml>

  -----------------------------------------
  Andrew Rich - VK4TEC
  vk4tec at tech-software.net
  www.tech-software.net
  Brisbane AUSTRALIA

_______________________________________________
Ozaprs mailing list
Ozaprs at aprs.net.au
http://aprs.net.au/mailman/listinfo/ozaprs



More information about the Ozaprs mailing list