Module mgrs
Military Grid Reference System (MGRS/NATO) classes Mgrs and MGRSError and
functions parseMGRS and toMgrs.
Pure Python implementation of MGRS / UTM conversion functions using an
ellipsoidal earth model, transcribed from JavaScript originals by (C)
Chris Veness 2014-2016 published under the same MIT Licence**, see MGRS and Module mgrs.
The MGRS/NATO grid references provides geocoordinate references
covering the entire globe, based on UTM projections.
MGRS references comprise a grid zone designation, a 100 km square
identification, and an easting and northing (in metres).
Depending on requirements, some parts of the reference may be omitted
(implied), and easting/northing may be given to varying resolution.
See also United States National Grid and Military Grid Reference System.
|
MGRSError
Military Grid Reference System (MGRS) parse or other Mgrs issue.
|
|
Mgrs
Military Grid Reference System (MGRS/NATO) references, with method
to convert to UTM coordinates.
|
|
parseMGRS(strMGRS,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
Mgrs=<class 'pygeodesy.mgrs.Mgrs'>,
name='
' )
Parse a string representing a MGRS grid reference, consisting of
zoneBand, grid, easting and northing. |
|
|
|
toMgrs(utm,
Mgrs=<class 'pygeodesy.mgrs.Mgrs'>,
name='
' )
Convert a UTM coordinate to an MGRS grid reference. |
|
|
parseMGRS(strMGRS,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
Mgrs=<class 'pygeodesy.mgrs.Mgrs'>,
name='
' )
|
|
Parse a string representing a MGRS grid reference, consisting of
zoneBand, grid, easting and northing.
- Parameters:
strMGRS - MGRS grid reference (str ).
datum - Optional datum to use (Datum).
Mgrs - Optional (sub-)class to return the MGRS grid reference (Mgrs) or
None .
name - Optional Mgrs name (str ).
- Returns:
- The MGRS grid reference (Mgrs)
or an Mgrs4Tuple
(zone, digraph, easting,
northing) if Mgrs is
None .
- Raises:
Example:
>>> m = parseMGRS('31U DQ 48251 11932')
>>> str(m)
>>> m = parseMGRS('31UDQ4825111932')
>>> repr(m)
>>> m = mgrs.parseMGRS('42SXD0970538646')
>>> str(m)
>>> m = mgrs.parseMGRS('42SXD9738')
>>> str(m)
|
toMgrs(utm,
Mgrs=<class 'pygeodesy.mgrs.Mgrs'>,
name='
' )
|
|
Convert a UTM coordinate to an MGRS grid reference.
- Parameters:
utm - A UTM coordinate (Utm or Etm).
Mgrs - Optional (sub-)class to return the MGRS grid reference (Mgrs) or
None .
name - Optional Mgrs name (str ).
- Returns:
- The MGRS grid reference (Mgrs)
or an Mgrs6Tuple
(zone, digraph, easting,
northing, band, datum) if Mgrs
is None .
- Raises:
Example:
>>> u = Utm(31, 'N', 448251, 5411932)
>>> m = u.toMgrs()
|