Created
June 24, 2010 09:56
-
-
Save ktopping/451258 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use mySociety::GeoUtil qw/national_grid_to_wgs84/; | |
use CAM::DBF; | |
my $filename = $ARGV[0]; | |
my $dbf = CAM::DBF->new($filename); | |
# Double-check the data is as we expect. | |
my @fieldnames = $dbf->fieldnames(); | |
die if $fieldnames[0] ne "PC1" || $fieldnames[6] ne "X" || $fieldnames[7] ne "Y"; | |
for my $row (0 .. $dbf->nrecords()-1) { | |
my @r = $dbf->fetchrow_array($row); | |
my ($pc, $east, $north) = ($r[0], $r[6], $r[7]); | |
my ($lat, $lng) = national_grid_to_wgs84($east, $north, "I"); # "I" means Ireland | |
print "$pc,$lat,$lng\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment