Package pygeodesy3 :: Package grids
[frames] | no frames]

Package grids

Various grids and de-/encodings.


Version: 23.12.18

Submodules

Classes
  EPSGError
EPSG encode, decode or other Epsg issue.
  Epsg
EPSG class, a named int.
  GARSError
Global Area Reference System (GARS) encode, decode or other Garef issue.
  Garef
Garef class, a named str.
  Geohash
Geohash class, a named str.
  GeohashError
Geohash encode, decode or other Geohash issue.
  Georef
Georef class, a named str.
  Mgrs
Military Grid Reference System (MGRS/NATO) references, with method to convert to UTM coordinates.
  Mgrs4Tuple
4-Tuple (zone, EN, easting, northing), zone and grid tile EN as str, easting and northing in meter.
  Mgrs6Tuple
6-Tuple (zone, EN, easting, northing, band, datum), with zone, grid tile EN and band as str, easting and northing in meter and datum a Datum.
  Neighbors8Dict
8-Dict (N, NE, E, SE, S, SW, W, NW) of Geohashes, providing key and attribute access to the items.
  OSGRError
Error raised for a parseOSGR, Osgr or other OSGR issue.
  Osgr
Ordnance Survey Grid References (OSGR) coordinates on the National Grid.
  Resolutions2Tuple
2-Tuple (res1, res2) with the primary (longitudinal) and secondary (latitudinal) resolution, both in degrees.
  WGRSError
World Geographic Reference System (WGRS) encode, decode or other Georef issue.
Functions
 
parseMGRS(strMGRS, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., Mgrs=<class 'pygeodesy3.grids.mgrs.Mgrs'>, name='')
Parse a string representing a MGRS grid reference, consisting of "[zone]Band, EN, easting, northing".
 
parseOSGR(strOSGR, Osgr=<class 'pygeodesy3.grids.osgr.Osgr'>, name='', **Osgr_kwds)
Parse a string representing an OS Grid Reference, consisting of "[GD] easting northing".
 
toMgrs(utmups, Mgrs=<class 'pygeodesy3.grids.mgrs.Mgrs'>, name='', **Mgrs_kwds)
Convert a UTM or UPS coordinate to an MGRS grid reference.
 
toOsgr(latlon, lon=None, kTM=False, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., Osgr=<class 'pygeodesy3.grids.osgr.Osgr'>, name='', **prec_Osgr_kwds)
Convert a lat-/longitude point to an OSGR coordinate.
Variables
  __getattr__ = _lazy_import_as(__name__)
Function Details

parseMGRS (strMGRS, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., Mgrs=<class 'pygeodesy3.grids.mgrs.Mgrs'>, name='')

 

Parse a string representing a MGRS grid reference, consisting of "[zone]Band, EN, easting, northing".

Arguments:
  • strMGRS - MGRS grid reference (str).
  • datum - Optional datum to use (Datum).
  • Mgrs - Optional class to return the MGRS grid reference (Mgrs) or None.
  • name - Optional Mgrs name (str).
Returns:
The MGRS grid reference as Mgrs or if Mgrs is None as an Mgrs4Tuple(zone, EN, easting, northing).
Raises:

parseOSGR (strOSGR, Osgr=<class 'pygeodesy3.grids.osgr.Osgr'>, name='', **Osgr_kwds)

 

Parse a string representing an OS Grid Reference, consisting of "[GD] easting northing".

Accepts standard OS Grid References like "SU 387 148", with or without whitespace separators, from 2- up to 22-digit references, or all-numeric, comma-separated references in meters, for example "438700,114800".

Arguments:
  • strOSGR - An OSGR coordinate (str).
  • Osgr - Optional class to return the OSGR coordinate (Osgr) or None.
  • name - Optional Osgr name (str).
  • Osgr_kwds - Optional, additional Osgr keyword arguments, ignored if Osgr is None.
Returns:
An (Osgr) instance or if Osgr is None an EasNor2Tuple(easting, northing).
Raises:

toMgrs (utmups, Mgrs=<class 'pygeodesy3.grids.mgrs.Mgrs'>, name='', **Mgrs_kwds)

 

Convert a UTM or UPS coordinate to an MGRS grid reference.

Arguments:
  • utmups - A UTM or UPS coordinate (Utm, Etm or Ups).
  • Mgrs - Optional class to return the MGRS grid reference (Mgrs) or None.
  • name - Optional Mgrs name (str).
  • Mgrs_kwds - Optional, additional Mgrs keyword arguments, ignored if Mgrs is None.
Returns:
The MGRS grid reference as Mgrs or if Mgrs is None as an Mgrs6Tuple(zone, EN, easting, northing, band, datum).
Raises:

toOsgr (latlon, lon=None, kTM=False, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran..., Osgr=<class 'pygeodesy3.grids.osgr.Osgr'>, name='', **prec_Osgr_kwds)

 

Convert a lat-/longitude point to an OSGR coordinate.

Arguments:
  • latlon - Latitude (degrees) or an (ellipsoidal) geodetic LatLon point.
  • lon - Optional longitude in degrees (scalar or None).
  • kTM - If True use Karney's Krüger method from module ktm, otherwise use the Ordnance Survey formulation (bool).
  • datum - Optional datum to convert lat, lon from (Datum, Ellipsoid, Ellipsoid2 or a_f2Tuple).
  • Osgr - Optional class to return the OSGR coordinate (Osgr) or None.
  • name - Optional Osgr name (str).
  • prec_Osgr_kwds - Optional truncate precision prec=ndigits and/or additional Osgr keyword arguments, ignored if Osgr is None.
Returns:
An (Osgr) instance or if Osgr is None an EasNor2Tuple(easting, northing).
Raises:
  • OSGRError - Invalid latlon or lon.
  • TypeError - Non-ellipsoidal latlon or invalid datum, Osgr, Osgr_kwds or conversion to Datums.OSGB36 failed.

Note: If isint(prec) both easting and northing are truncated to the given number of digits.