Geo::Coordinates::OSGB 1.07 review

Download
by rbytes.net on

Geo::Coordinates::OSGB is a Perl module that can convert coordinates from Lat/Long to UK Grid. A UK-specific implementation of co-

License: Perl Artistic License
File size: 3K
Developer: Toby Thurston
0 stars award from rbytes.net

Geo::Coordinates::OSGB is a Perl module that can convert coordinates from Lat/Long to UK Grid.

A UK-specific implementation of co-ordinate conversion, following formulae from the Ordnance Survey of Great Britain (hence the name).

SYNOPSIS

use Geo::Coordinates::OSGB qw(ll2grid grid2ll);

# basic conversion routines
($easting,$northing) = ll2grid($lat,$lon);
($lat,$long) = grid2ll($easting,$northing);

# format full easting and northing into traditional formats
$trad_gr = format_grid_trad($easting,$northing); # TQ 234 098
$GPS_gr = format_grid_GPS($easting,$northing); # TQ 23451 09893
$landranger_gr = format_grid_landranger($easting, $northing) # 234098 on Sheet 176

# you can call these in list context to get the individual parts
# add "=~ s/s//g" to the result to remove the spaces

# and there are corresponding parse routines to convert from these formats to full e,n
($e,$n) = parse_trad_grid('TQ 234 098'); # spaces optional, can give list as well
($e,$n) = parse_GPS_grid('TQ 23451 09893'); # spaces optional, can give list as well
($e,$n) = parse_landranger_grid($sheet, $gre, $grn); # gre/grn must be 3 or 5 digits long
($e,$n) = parse_landranger_grid($sheet); # this gives you the SW corner of the sheet

# some convenience routines that bundle these up for you
map2ll();
map2grid();

# set parameters
set_ellipsoid(6377563.396,6356256.91); # not needed for UK use
set_projection(49, -2, 400000, -100000, 0.9996012717); # not needed for UK use

This module provides a collection of routines to convert between longitude & latitude and map grid references, using the formulae given in the British Ordnance Survey's excellent information leaflet, referenced below in "Theory".

The module is implemented purely in Perl, and should run on any Perl platform. In this description `OS' means `the Ordnance Survey of Great Britain': the UK government agency that produces the standard maps of England, Wales, and Scotland. Any mention of `sheets' or `maps' refers to one or more of the 204 sheets in the 1:50,000 scale `Landranger' series of OS maps.

Requirements:
Perl

Geo::Coordinates::OSGB 1.07 keywords