Geo-Coordinates-OSGB
view release on metacpan or search on metacpan
lib/Geo/Coordinates/OSGB.pm view on Meta::CPAN
1;
=pod
=head1 NAME
Geo::Coordinates::OSGB - Convert coordinates between Lat/Lon and the British National Grid
An implementation of co-ordinate conversion for England, Wales, and Scotland
based on formulae and data published by the Ordnance Survey of Great Britain.
=head1 VERSION
2.20
=for HTML <a href="https://travis-ci.org/thruston/perl-geo-coordinates-osgb">
<img src="https://travis-ci.org/thruston/perl-geo-coordinates-osgb.svg?branch=master"></a>
=head1 SYNOPSIS
lib/Geo/Coordinates/OSGB.pm view on Meta::CPAN
# Latitude and longitude according to the WGS84 model
($lat, $lon) = grid_to_ll($e, $n);
# and to go the other way
($e, $n) = ll_to_grid($lat,$lon);
See the test files for more examples of usage.
=head1 BUGS AND LIMITATIONS
The formulae supplied by the OS and used for the conversion routines are
specifically designed to be close floating-point approximations rather
than exact mathematical equivalences. So after round-trips like these:
($lat1,$lon1) = grid_to_ll(ll_to_grid($lat0,$lon0));
($e1,$n1) = ll_to_grid(grid_to_ll($e0,$n0));
neither C<$lat1 == $lat0> nor C<$lon1 == $lon0> nor C<$e1 == $e0> nor
C<$n1 == $n0> exactly. However the differences should be very small.
The OS formulae were designed to give an accuracy of about 1 mm of
error. This means that you can rely on the third decimal place for grid
references and about the seventh or eighth for latitude and longitude
(although the OS themselves only provide six decimal places in their
results).
For all of England, Wales, Scotland, and the Isle of Man the error will be
tiny. All other areas, like Northern Ireland, the Channel Islands or Rockall,
and any areas of sea more than a few miles off shore, are outside the coverage
of OSTN, so the simpler, less accurate transformation is used. The OS state
that this is accurate to about 5m but that the parameters used are only valid
lib/Geo/Coordinates/OSGB/Background.pod view on Meta::CPAN
Geo::Coordinates::OSGB::Background - Background and extended description
=head1 VERSION
2.20
=head1 DESCRIPTION
These notes are part of Geo::Coordinates::OSGB, a Perl implementation of
latitude and longitude co-ordinate conversion for England, Wales, and
Scotland based on formulae and data published by the Ordnance Survey of
Great Britain.
These modules will convert accurately between an OSGB national grid
reference, and coordinates given in latitude and longitude using the
WGS84 model. This means that you can take latitude and longitude
readings from your GPS receiver, (or read them from Wikipedia, or Google
Earth, or your car's sat-nav), and use this module to convert them to an
accurate British National grid reference for use with one of the
Ordnance Survey's paper maps. And I<vice versa>, of course.
lib/Geo/Coordinates/OSGB/Background.pod view on Meta::CPAN
approximate routine is likely to remain slightly faster. Having said that
none of the routines is really slow, since even C<grid_to_ll> averages under 60
microseconds per call on the older machine. `Your mileage may vary', of
course.
The routines have been tested with various versions of Perl, including recent
versions with the C<uselongdouble> option enabled. Using a locally compiled
version of Perl 5.22 with ordinary doubles, I saw a small improvement on the
Helmert routines, but the default routines are about the same. On the same
system, long doubles slowed everything down by about 10%, and made no
difference to the round trip precision of the routines. Since the formulae were
specifically designed for ordinary double precision arithmetic, Perl's default
arithmetic is more than adequate.
=head2 Maps
Since Version 2.09 these modules have included a set of map sheet
definitions so that you can find which paper maps your coordinates are
on.
See L<Geo::Coordinates::OSGB::Maps> for details of the series included.
( run in 0.318 second using v1.01-cache-2.11-cpan-26ccb49234f )