Order Tray | Contact Us | Home | SIG Lists

[aprssig] X nm / Y nm to lat / lon

Andrew Rich (Home) vk4tec at tech-software.net
Tue Jul 28 12:29:55 UTC 2009


Done

#!/usr/bin/perl
use Geo::Ellipsoid;
open (file, "/maint/scripts/sample.txt");
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 "<Folder>\n";
print "<name>Track457</name>\n";
while (<file>)
{
@data = split(/\t/);
$geo = Geo::Ellipsoid->new(ellipsoid=>'WGS84', units=>'degrees',distance_units=>'kilometer');
$x_km = ($data[49]*1.852);
$y_km = ($data[50]*1.852);
@pos = $geo->location( -37.652865, 144.874274, $x_km, $y_km );
$lat2 = $pos[0];
$lon2 = $pos[1];
print "<Placemark>\n";
print "<name></name>";
print "<LookAt>\n";
print "<longitude>".$lon2."</longitude>\n";
print "<latitude>".$lat2."</latitude>\n";
print "</LookAt>\n";
print "<styleUrl>root://styles#default+icon=0x307</styleUrl>\n";
print "<Style>\n";
print "<LabelStyle>\n";
print "<scale>0.7</scale>\n";
print "</LabelStyle>\n";
print "<IconStyle>\n";
print "<scale>0.8</scale>";
print "<heading>".$data[52]."</heading>";
print "<Icon>\n";
print "<href>root://icons/palette-2.png</href>\n";
print "</Icon>\n";
print "</IconStyle>\n";
print "</Style>\n";
print "<Point>\n";
print "<extrude>1</extrude>\n";
print "<altitudeMode>relativeToGround</altitudeMode>\n";
print "<coordinates>";
print "$lon2,$lat2,0";
print "</coordinates> \n";
print "</Point>\n";
print "</Placemark>\n";
}
print "</Folder>\n";
print "</kml> \n";                    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tapr.org/pipermail/aprssig/attachments/20090728/08f33231/attachment.htm>


More information about the aprssig mailing list