Package pygeodesy :: Module osgr :: Class Osgr
[frames] | no frames]

Class Osgr

object --+    
         |    
bases.Base --+
             |
            Osgr

OSGR coordinate.

Instance Methods
 
__init__(self, easting, northing)
New OSGR National Grid Reference.
 
parse(self, strOSGR)
Parse a string to an Osgr instance.
 
toLatLon(self, LatLon, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)
Convert this OSGR coordinate to an (ellipsoidal) geodetic point.
 
toStr(self, prec=10, sep=' ')
Return a string representation of this OSGR coordinate.
 
toStr2(self, prec=10, fmt='[%s]', sep=', ')
Return a string representation of this OSGR coordinate.

Inherited from bases.Base: __repr__, __str__, classname, others, topsub

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties
  datum
Get the datum (Datum).
  easting
Get the easting (meter).
  northing
Get the northing (meter).

Inherited from object: __class__

Method Details

__init__(self, easting, northing)
(Constructor)

 

New OSGR National Grid Reference.

Parameters:
  • easting - Easting from OS false easting (meter).
  • northing - Northing from from OS false northing (meter).
Raises:
  • ValueError - Invalid OSGR grid reference.
Overrides: object.__init__

Example:

>>> from pygeodesy import Osgr
>>> r = Osgr(651409, 313177)

parse(self, strOSGR)

 

Parse a string to an Osgr instance.

For more details, see function parseOSGR in this module osgr.

toLatLon(self, LatLon, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran...)

 

Convert this OSGR coordinate to an (ellipsoidal) geodetic point.

Note formulation implemented here due to Thomas, Redfearn, etc. is as published by OS, but is inferior to Krüger as used by e.g. Karney 2011.

Parameters:
  • LatLon - LatLon class for the point (LatLon).
  • datum - Darum to use (Datum).
Returns:
The geodetic point (LatLon).
Raises:
  • TypeError - If LatLon is not ellipsoidal.

Example:

>>> from pygeodesy import ellipsoidalVincenty as eV
>>> g = Osgr(651409.903, 313177.270)
>>> p = g.toLatLon(ev.LatLon)  # 52°39′28.723″N, 001°42′57.787″E
>>> # to obtain (historical) OSGB36 lat-/longitude point
>>> p = g.toLatLon(ev.LatLon, datum=Datums.OSGB36)  # 52°39′27.253″N, 001°43′04.518″E

toStr(self, prec=10, sep=' ')

 

Return a string representation of this OSGR coordinate.

Note that OSGR coordinates are truncated, not rounded (unlike UTM grid references).

Parameters:
  • prec - Number of digits (int).
  • sep - Separator to join (string).
Returns:
This OSGR as string "EN meter meter" or as "meter,meter' if prec non-positive (string).
Overrides: bases.Base.toStr

Example:

>>> r = Osgr(651409, 313177)
>>> str(r)  # TG 5140 1317
>>> r.toStr(prec=0)  # 651409,313177

toStr2(self, prec=10, fmt='[%s]', sep=', ')

 

Return a string representation of this OSGR coordinate.

Parameters:
  • prec - Number of digits (int).
  • fmt - Enclosing backets format (string).
  • sep - Separator to join (string).
Returns:
This OSGR as "[G:00B, E:meter, N:meter]" or as "OSGR:meter,meter" if prec non-positive (string).
Overrides: bases.Base.toStr2

Property Details

datum

Get the datum (Datum).

Get Method:
datum(self) - Get the datum (Datum).

easting

Get the easting (meter).

Get Method:
easting(self) - Get the easting (meter).

northing

Get the northing (meter).

Get Method:
northing(self) - Get the northing (meter).