osgb
Platforms & distributions
- Python package
- platform-independent source code
Repositories
Development status
Stable.
Latest version
See below.
Background
Many geospatial locations within the UK are given with the Ordnance Survey system. While common and highly accurate, this coordinate system is peculiar to the UK and incompatible with many modern cartography tools. This module presents functions for converting between these and the most widely spread longitude-latitude system.
Installation
This package can be installed by the usual Pythonic methods:
use your favourite installation tool:
% easy_install osgb
or download the source, unpack it, change into the directory and call:
% python setup.py install
Usage
osgb provides two primary functions, osgb_to_lonlat and lonlat_to_osgb, which are imported into the top of this package. Some of the intermediate conversions are provided for those who may find them useful (e.g. for working in eastings-northings).
Limitations
By convention, longitude and latitude are referred and used in that order.
Note that the lon-lats are returned are OSGB36 (not the more modern WGS84), as that is the system OSGB is based upon. The difference should be minimal (i.e. less than 100 metres). For example, the OS grid reference TM114 525 (just outside Ipswich) should convert to the lon-lat 1.088975 52.129892 in OSGB36, which is 1.087203 52.130350 in WGS84.
References
- The Ordnance Survey provides a guide to coordinate systems, the equations for conversion and the required constants.
- A nice explanation of the OSGB system can be found here
- J Stott provides a PHP library as well as Javascript and Java implementations. Chris Veness' Javascript implementation was a useful reference in the conversion, as was A. Rutherfords Geoposition. The Perl module Geo::Coordinates::OSGB provides similar services.
- Nearby.org.uk provides conversion between many geospatial formats including OS.