Ignore:
Timestamp:
Feb 7, 2007, 4:08:30 PM (13 years ago)
Author:
Nick Burch
Message:

Pull out e+n -> lat+long into a npemap perl module, and use from the geocoder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/scripts/exporter/export.pl

    r460 r461  
    2525use FindBin;
    2626use lib "$FindBin::Bin/../../perllib";
    27 use Geo::HelmertTransform;
     27use NPEMap::GeoConverter;
    2828
    2929my $mode = shift;
     
    5959while(my ($outer,$inner,$e,$n) = $query->fetchrow_array) {
    6060        # Generate lat+long
    61         my ($lat,$long) = makeLatLong($e,$n);
     61        my ($lat,$long) = eastingNorthingToLatLong($e,$n);
    6262
    6363        # Make e+n look nicer
     
    7575$conn->disconnect;
    7676
    77 
    78 ############################################################################
    79 
    80 sub makeLatLong {
    81         my ($e,$n) = @_;
    82 
    83         # Turn e+n into OSGB lat+long
    84         my $point = Geography::NationalGrid::GB->new( Easting=>$e, Northing=>$n );
    85         my $oslat = $point->latitude;
    86         my $oslong = $point->longitude;
    87 
    88         # Turn OSGB lat+long into WGS84 lat+long
    89         my $osgb_helper = Geo::HelmertTransform::datum("Airy1830");
    90         my $wgs84_helper = Geo::HelmertTransform::datum('WGS84');
    91 
    92         my ($lat,$long,$h) =
    93                 Geo::HelmertTransform::convert_datum($osgb_helper, $wgs84_helper, $oslat, $oslong, 0);
    94 
    95         return ($lat,$long);
    96 }
    9777
    9878############################################################################
Note: See TracChangeset for help on using the changeset viewer.