|
Geography::NationalGrid::GB - Module to convert British National Grid references to/from Latitude and Longitude |
Geography::NationalGrid::GB - Module to convert British National Grid references to/from Latitude and Longitude
You should create the object using the Geography::NationalGrid factory class, but you still need to know the object interface, given below.
my $point1 = new Geography::NationalGrid::GB(
GridReference => 'TQ 289816',
);
my $point2 = new Geography::NationalGrid::GB(
Latitude => 51.783,
Longitude => 0
);
print "Point 1 is " . $point->latitude . " degrees north\n";
Once created, the object allows you to retrieve information about the point that the object represents. For example you can create an object using a grid reference and the retrieve the latitude and longitude.
These are the options accepted in the constructor. You MUST provide either a GridReference or Latitude and Longitude, or Easting and Northing (the origin for these is the usual location of SV 000000).
NOTE: if you use a projection other than the default then the results for the gridReference() method will be wrong,
so the method will return undef.
However, you can use the northing() and easting() results instead to find the location in the desired projection.
data() method.
Most of these methods take no arguments. Some are inherited from Geography::NationalGrid
The routines used in this code may not give you completely accurate results for various mathematical and theoretical reasons. In tests the results appeared to be correct, but it may be that under certain conditions the output could be highly inaccurate. It is likely that output accuracy decreases further from the datum, and behaviour is probably divergent outside the intended area of the grid.
This module has been coded in good faith but it may still get things wrong. Hence, it is recommended that this module is used for preliminary calculations only, and that it is NOT used under any circumstance where its lack of accuracy could cause any harm, loss or other problems of any kind. Beware!
That said, the 2 worked examples provided by the Ordnance Survey yield the correct results with this module. Further tests are needed, and comparison with actual Landranger or larger-scale OS maps.
Equations for converting co-ordinate systems appear in the guide at http://www.gps.gov.uk/guidecontents.asp - entitled ``A guide to coordinate systems in Great Britain: A primer on coordinate system concepts, including full information on GPS and Ordnance Survey coordinate systems.''
National Grid letter-pairs checked at http://edina.ac.uk/digimap/data/gridreference.html
ISO 3166 Country codes checked against http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html
Conversions compared with software from ftp://ftp.kv.geo.uu.se/pub/ and online services
Copyright (c) 2002 P Kent. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
$Revision: 1.3 $
|
Geography::NationalGrid::GB - Module to convert British National Grid references to/from Latitude and Longitude |