Skip to main content

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.

Note

Conversion from lat / long to grid andthen back to lat / long generally does not end up with the original values.This is due to a combination of internal rounding errors, plus the fact thatthe National Grid resolves points to 10m x 10m squares. In the examples above, the before and after latitudes differ by approx. 1.0e-5 and the longitudes by approx. 3.0e-3; this is typical.

Metadata

Release files for OSGridConverter 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for OSGridConverter 0.1.3
File Size Uploaded
OSGridConverter-0.1.3.tar.gz 15.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for OSGridConverter 0.1.3
File Interpreter ABI Platform
OSGridConverter-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / OSGridConverter-0.1.3.tar.gz

Download URL OSGridConverter-0.1.3.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a2eb1b2585c0ce696c78f2db981e797fbaf8bb9207d97ad4649865b58118aabd
BLAKE2b-256 checksum
How to use checksums
502b1d814a7b1454f824be39fe7f47519dc89dc311e0425b6d0dc8be4d255912
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / OSGridConverter-0.1.3-py3-none-any.whl

Download URL OSGridConverter-0.1.3-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbdc9031e8b289766de9d54ff707e42a732592588567edb14ec1369833e9f940
BLAKE2b-256 checksum
How to use checksums
3baa9c987e3af57d2221a67ebfe57c0fc090f177a5fe736593814f2ad0de5b40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page