#!/usr/local/bin/perl -w
=head1 DESCRIPTION
Converts waypoints to HTML containing topozone.com URLs.
By default, the waypoints are read from STDIN,
use the -d option to read them from DATA
=cut
$stdin = (@ARGV+0 == 0 || $ARGV[0] ne '-d');
$fh = ($stdin ? *STDIN : *DATA);
print '
waypoints', "\n";
while (<$fh>) {
chomp;
s/#.*//;
next if /^\s*$/;
@ff = split /\s+/;
if (@ff+0 < 3) {
printf STDERR "%s ?\n", $_;
next;
}
$ss = sprintf(
'http://www.topozone.com/map.asp?lat=%s&lon=%s'
. '&datum=nad83&u=5&layer=DRG25&size=m&s=24'
,$ff[1],$ff[2]
);
printf( '%s %s', $ff[0], $ss, $ss );
print "
\n";
}
print '', "\n";
__DATA__
# Format: DDD 1 WGS 84
001 40.25647 -140.83516
002 40.25939 -140.83474
003 40.26078 -140.83393
004 40.26323 -140.82140
005 40.26465 -140.82774