1) Install proj4 from http://trac.osgeo.org/proj/wiki/WikiStart#Download
2) Do the ugly:
# this works, would you adam and eve it
sub coords2pols {
my ($lat, $lon) = @_;
if ($lon > -50) {
($lon, $lat) = ($lat, $lon);
}
open my $fhi, '>tmp.txt' or die "tmp file $!";
print $fhi "$lon $lat\n";
close $fhi;
system('cs2cs +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +to +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs tmp.txt > tmp.out.txt') and die "$@";
open my $fh, '
my $line = <$fh>;
close($fh);
chomp($line);
my ($x, $y) = split(/\s+/, $line);
unlink('tmp.txt');
unlink('tmp.out.txt');
($x, $y);
}
Boo, Polar Stereographic makes stuff upside down...
ReplyDeleteAs a former resident of 26W 77S, I beg to differ :)
ReplyDelete