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 OS National Grid and Module osgridref.
OSGR provides geocoordinate references for UK mapping purposes,
converted in 2015 to work with WGS84 datum by default or OSGB36 as
option.
See Guide, Proposed Changes, Confirmation and Ordnance Survey National Grid.
See also Karney 'Transverse Mercator with an accuracy of a few
nanometers', 2011 (building on Krüger 'Konforme Abbildung des Erdellipsoids in der Ebene',
1912), Seidel 'Die Mathematik der Gauß-Krueger-Abbildung', 2006 and
Transverse Mercator: Redfearn series.
|
Osgr
Ordinance Survey Grid References (OSGR) coordinate.
|
|
parseOSGR(strOSGR,
Osgr=<class 'pygeodesy.osgr.Osgr'>,
name='
' )
Parse 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'>,
name='
' )
Convert a lat-/longitude point to an OSGR coordinate. |
|
|
parseOSGR(strOSGR,
Osgr=<class 'pygeodesy.osgr.Osgr'>,
name='
' )
|
|
Parse 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 (str ).
Osgr - Optional (sub-)class to use for the OSGR coordinate (Osgr) or
None .
name - Optional Osgr name (str ).
- Returns:
- The OSGR coordinate (Osgr) or the 2-tuple (easting, northing) if
Osgr is
None .
- 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'>,
name='
' )
|
|
Convert a lat-/longitude point to an OSGR coordinate.
- Parameters:
latlon - Latitude (degrees ) or an (ellipsoidal) geodetic
LatLon point.
lon - Optional longitude in degrees (scalar or None ).
datum - Optional datum to convert (Datum ).
Osgr - Optional (sub-)class to use for the OSGR coordinate (Osgr) or
None .
name - Optional Osgr name (str ).
- Returns:
- The OSGR coordinate (Osgr) or 2-tuple (easting, northing) if
Osgr is
None .
- Raises:
TypeError - Non-ellipsoidal latlon or datum conversion failed.
ValueError - Invalid latlon or lon.
Example:
>>> p = LatLon(52.65798, 1.71605)
>>> r = toOsgr(p)
>>>
>>> r = toOsgr(52.65757, 1.71791, datum=Datums.OSGB36)
|