Changeset 510 for trunk


Ignore:
Timestamp:
Mar 26, 2007, 10:32:49 AM (13 years ago)
Author:
Nick Burch
Message:

Include 2+6 NGRs in the dump

Location:
trunk/npemap.org.uk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/perllib/NPEMap/GeoConverter.pm

    r461 r510  
    1717require Exporter;
    1818@ISA    = qw(Exporter);
    19 @EXPORT = qw(eastingNorthingToLatLong);
     19@EXPORT = qw(eastingNorthingToLatLong eastingNorthingToNGR);
    2020
    2121sub eastingNorthingToLatLong {
     
    3737}
    3838
     39sub eastingNorthingToNGR {
     40        my ($e,$n) = @_;
     41
     42        # Turn e+n into 2+6 NGR
     43        my $point = Geography::NationalGrid::GB->new( Easting=>$e, Northing=>$n );
     44        return $point->gridReference(100);
     45}
     46
    3947############################################################################
    4048
  • trunk/npemap.org.uk/scripts/exporter/export.pl

    r461 r510  
    5050print "# This information is public domain, and comes from http://www.npemap.org.uk/\n";
    5151print "#\n";
    52 print "# <outward>,<inward>,<easting>,<northing>,<WGS84 lat>,<WGS84 long>\n";
     52print "# <outward>,<inward>,<easting>,<northing>,<WGS84 lat>,<WGS84 long>,<2+6 NGR>\n";
    5353
    5454# Get our data fetch query
     
    6060        # Generate lat+long
    6161        my ($lat,$long) = eastingNorthingToLatLong($e,$n);
     62        # Generate 2+6 NGR
     63        my $ngr = eastingNorthingToNGR($e,$n);
    6264
    6365        # Make e+n look nicer
     
    6971        $long = sprintf("%0.6f", $long);
    7072
    71         print "$outer,$inner,$e,$n,$lat,$long\n";
     73        print "$outer,$inner,$e,$n,$lat,$long,$ngr\n";
    7274}
    7375
Note: See TracChangeset for help on using the changeset viewer.