Skip to main content

Library to convert co-ordinates between the (UK) Ordnance Survey National Grid and latitude/longitude

Project description

Description

This package allowd the user to manipulate co-ordinates on the Earth’s surface in the two major co-ordinate systems: latitude / longitude measured in degrees, and cartographic systems, measured in eastings and northings, based on a local ellipsoidal approximation to the Earth’s geoid.

In particular, it provides tools for processing coordinates (of the form AB 12345 12345) based on the National Grid, defined by the UK Ordnance Survey. For more information, see the Ordnance Survey’s National Grid FAQ page.

The package provides basic functions to convert latitude / longitude to the National Grid and vice versa. However, underneath this is a comprehensive system for mapping, and transforming between different co-ordinate systems, including those for the UK, the Republic of Ireland, France, North America, and Japan.

Simple Conversion

OSGridConverter.**latlong2grid**(latitude, longitude, tag = ‘WGS84’)

Converts from latitude / longitude to an OS Grid Reference.

latitude:

The latitude of the point, expressed in decimal degrees North

longitude:

The longitude of the point, expressed in decimal degrees East

tag:

The name of the datum used in the conversion; default is WGS84, referring to the standard datum used by Ordnance Survey

Return value is an OSGridReference object. For the purpose of simple conversions, what matters is that, of g is such an object, then g.E and g.N are respectively its easting and northing, expressed in metres, and str(g) returns the formatted National Grid reference.

Example:

>>> from OSGridConverter import latlong2grid
>>> g=latlong2grid(52.657977,1.716038)
>>> (g.E,g.N)
(651408, 313177)
>>> str(g)
'TG 51408 13177'

OSGridConverter.**grid2latlong**(grid, tag = ‘WGS84’)

Converts from an OS Grid Reference to latitude / longitude.

grid:

The point to be converted. Either an OSGridReference object, or a string formatted as an Ordnance Survey grid reference, e.g. ‘TG 51408 13177’

tag:

The name of the mapping datum used in the conversion; default is WGS84, referring to the standard datum used by Ordnance Survey

Return value is a LatLong object. For the purpose of simple conversions, what matters is that, of l is such an object, then l.latitude is its latitude expressed oin decimal degrees North, and g.longitude is its longitude expressed in decimal degrees East.

Example[#]_:

>>> from OSGridConverter import grid2latlong
>>> l=grid2latlong('TG 51408 13177')
>>> (l.latitude,l.longitude)
(52.65798005789814, 1.7200761111093394)

OSGridConverter.**Tags**

A list of strings: names of the standing mapping Data that the package is aware of and can convert between. Its members are the valid values that can be used in the tag field of the conversion functions.

Tag

Details

WSG84

UK

OSGB36

Former UK standard (replaced by WGS84)

ED50

UK; used for oil and gas exploration

Irl1975

Republic of Ireland

NTF

France

TokyoJapan

Japan

NAD83

North America; very similar to WGS84

For more information (and more examples of mapping Data) see the Wikipedia page on Geodetic Datum.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

OSGridConverter-0.1.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

OSGridConverter-0.1.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file OSGridConverter-0.1.1.tar.gz.

File metadata

File hashes

Hashes for OSGridConverter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 93aa96c9b576b40824aee451577dd2995287038ee97f5090cdd11507f6ad2cce
MD5 b67842ee84fc90846d3c3d2c9aeebbf6
BLAKE2b-256 81ac658114468fddc25a84ee3b22426b0d6afdf06de89588892ebd9bee3e357c

See more details on using hashes here.

File details

Details for the file OSGridConverter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for OSGridConverter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ca92e2b0e488f76842885423d7b7d8264b786f1ac42d33bb34629dd6fbba3b7
MD5 53d323d48efee6b2b793518d00f441aa
BLAKE2b-256 ca66ef9352bacb0a644144fa9b0548c543cddd11e3ccf2848e7ad83fb78c1b86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page