Module osgr
Ordinance Survey Grid References (OSGR) class Osgr and functions
parseOSGR
and toOsgr.
Pure Python implementation of OS Grid Reference functions using an
ellipsoidal earth model, transcribed from JavaScript originals by (C)
Chris Veness 2005-2016 published under the same MIT Licence**, see http://www.movable-type.co.uk/scripts/latlong-os-gridref.html
and http://www.movable-type.co.uk/scripts/geodesy/docs/module-osgridref.html.
OSGR provides geocoordinate references for UK mapping purposes,
converted 2015 to work with WGS84 datum by default or OSGB36 as
option.
See http://www.OrdnanceSurvey.co.uk/docs/support/guide-coordinate-systems-great-britain.pdf,
http://www.OrdnanceSurvey.co.uk/blog/2014/09/proposed-changes-to-latitude-and-longitude-representation-on-paper-maps-tell-us-your-thoughts/,
http://www.OrdnanceSurvey.co.uk/blog/2014/12/confirmation-on-changes-to-latitude-and-longitude
and http://wikipedia.org/wiki/Ordnance_Survey_National_Grid.
See also Karney 2011 "Transverse Mercator with an accuracy of a
few nanometers" and Krüger 1912 "Konforme Abbildung des
Erdellipsoids in der Ebene", references http://arxiv.org/pdf/1002.1417v3.pdf, http://bib.gfz-potsdam.de/pub/digi/krueger2.pdf, http://henrik-seidel.gmxhome.de/gausskrueger.pdf and http://wikipedia.org/wiki/Transverse_Mercator:_Redfearn_series.
|
parseOSGR(strOSGR)
Parses an OSGR coordinate string to an Osgr instance. |
|
|
|
toOsgr(latlon,
lon=None,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
Osgr=<class 'pygeodesy.osgr.Osgr'>)
Converts lat-/longitude point to na OSGR coordinate. |
|
|
Parses an OSGR coordinate string to an Osgr instance.
Accepts standard OS Grid References like 'SU 387 148', with or without
whitespace separators, from 2- up to 10-digit references (1 m × 1 m
square), or fully numeric, comma-separated references in metres, for
example '438700,114800'.
- Parameters:
strOSGR - An OSGR coordinate (string).
- Returns:
- The OSGR coordinate (Osgr).
- Raises:
ValueError - Invalid strOSGR.
Example:
>>> g = parseOSGR('TG 51409 13177')
>>> str(g)
>>> g = parseOSGR('TG5140913177')
>>> str(g)
>>> g = parseOSGR('TG51409 13177')
>>> str(g)
>>> g = parseOSGR('651409,313177')
>>> str(g)
>>> g.toStr(prec=0)
|
toOsgr(latlon,
lon=None,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
Osgr=<class 'pygeodesy.osgr.Osgr'>)
|
|
Converts lat-/longitude point to na OSGR coordinate.
- Parameters:
latlon - Latitude (degrees) or an (ellipsoidal) geodetic LatLon
point.
lon - Longitude in degrees (scalar or None).
datum - Datum to convert (Datum).
Osgr - Osgr class for the OSGR coordinate (Osgr).
- Returns:
- The OSGR coordinate (Osgr).
- Raises:
TypeError - If latlon is not ellipsoidal.
ValueError - If latlon or lon is invalid.
Example:
>>> p = LatLon(52.65798, 1.71605)
>>> r = toOsgr(p)
>>>
>>> r = toOsgr(52.65757, 1.71791, datum=Datums.OSGB36)
|