Package pygeodesy :: Module mgrs :: Class Mgrs |
[frames] | no frames]

# Class Mgrs

      object --+
               |
    named._Named --+
                   |
    named._NamedBase --+
                       |
                      Mgrs

Military Grid Reference System (MGRS/NATO) references, with method to convert to UTM coordinates.

Instance Methods
__init__(self, zone, en100k, easting, northing, band='', datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran`...`, resolution=0, name='') New Mgrs Military grid reference. |
parse(self, strMGRS, name='') Parse a string to a similar Mgrs instance. |
toLatLon(self, LatLon=None, center=True, **toLatLon_kwds) Convert this MGRS grid reference to a UTM coordinate. |
toRepr(self, prec=10, fmt='[%s]', sep=', ') Return a string representation of this MGRS grid reference. |
toStr(self, prec=10, sep=' ') Return a string representation of this MGRS grid reference. |
toUtm(self, Utm=<class 'pygeodesy.utm.Utm'>, center=False) Convert this MGRS grid reference to a UTM coordinate. |
Inherited from `named._NamedBase`: `__repr__`, `__str__`, `others` Inherited from `named._Named`: `_DOT_`, `attrs`, `classof`, `copy`, `rename`, `toStr2` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| band Get the latitudinal band (`str, 'A'|'B'..'Y'|'Z'`).
| bandLatitude Get the band latitude (`degrees90` or `None`).
| datum Get the datum (Datum).
| en100k Get the 2-character grid EN digraph (`str`).
| digraph Get the 2-character grid EN digraph (`str`).
| easting Gets the easting (`meter`).
| eastingnorthing Get easting and northing (EasNor2Tuple`(easting, northing)`).
| northing Get the northing (`meter`).
| resolution Get the resolution (`meter`).
| zone Get the longitudal zone (`int`, 1..60).
Inherited from `named._Named`: `classname`, `classnaming`, `name`, `named`, `named2`, `named3`, `named4` Inherited from `object`: `__class__`

Method Details

### __init__ (self, zone, en100k, easting, northing, band='', datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran`...`, resolution=0, name='') (Constructor) |
New Mgrs Military grid reference. Arguments: `zone` - 6° longitudinal zone (`int`), 1..60 covering 180°W..180°E. `en100k` - Two-letter EN digraph (`str`), 100 km grid square. `easting` - Easting (`meter`), within 100 km grid square. `northing` - Northing (`meter`), within 100 km grid square. `band` - Optional 8° latitudinal band (`str`), C..X covering 80°S..84°N. `datum` - Optional this reference's datum (Datum, Ellipsoid, Ellipsoid2 or a_f2Tuple). `resolution` - Optional resolution, cell size (`meter`) or `0`. `name` - Optional name (`str`). Raises: `MGRSError` - Invalid MGRS grid reference, `zone`, `en100k`, `easting`, `northing` or `band`. `TypeError` - Invalid `datum`. Overrides: object.__init__ Example:
    >>> from pygeodesy import Mgrs
    >>> m = Mgrs('31U', 'DQ', 48251, 11932)  # 31U DQ 48251 11932

### parse (self, strMGRS, name='') |
Parse a string to a similar Mgrs instance. Arguments: `strMGRS` - The MGRS reference (`str`), see function parseMGRS. `name` - Optional instance name (`str`), overriding this name. Returns: The similar instance (Mgrs). Raises: `MGRSError` - Invalid `strMGRS`.

### toLatLon (self, LatLon=None, center=True, **toLatLon_kwds) |
Convert this MGRS grid reference to a UTM coordinate. Arguments: `LatLon` - Optional, ellipsoidal class to return the geodetic point (`LatLon`) or `None`. `center` - Optionally, return the grid's center or lower left corner C({bool}). `toLatLon_kwds` - Optional, additional Utm.toLatLon and `LatLon` keyword arguments. Returns: A `LatLon` instance or if `LatLon is None` a LatLonDatum5Tuple`(lat, lon, datum, convergence, scale)`. Raises: `TypeError` - If `LatLon` is not ellipsoidal. `UTMError` - Invalid meridional radius or H-value. See Also: Methods Mgrs.toUtm and Utm.toLatLon.

### toRepr (self, prec=10, fmt='[%s]', sep=', ') |
Return a string representation of this MGRS grid reference. Arguments: `prec` - Optional number of digits (`int`), 4:Km, 10:m. `fmt` - Optional enclosing backets format (`str`). `sep` - Optional separator between name:values (`str`). Returns: This Mgrs as "[Z:00B, G:EN, E:meter, N:meter]" (`str`). Overrides: named._Named.toRepr

### toStr (self, prec=10, sep=' ') |
Return a string representation of this MGRS grid reference. Note that MGRS grid references are truncated, not rounded (unlike UTM coordinates). Arguments: `prec` - Optional number of digits (`int`), 4:Km, 10:m. `sep` - Optional separator to join (`str`) or `None` to return an unjoined `tuple` of `str`s. Returns: This Mgrs as "00B EN easting northing" (`str`). Raises: `ValueError` - Invalid `prec`. Overrides: named._Named.toStr Example:
    >>> m = Mgrs(31, 'DQ', 48251, 11932, band='U')
    >>> m.toStr()  # '31U DQ 48251 11932'

### toUtm (self, Utm=<class 'pygeodesy.utm.Utm'>, center=False) |
Convert this MGRS grid reference to a UTM coordinate. Arguments: `Utm` - Optional class to return the UTM coordinate (Utm) or `None`. `center` - Optionally, center easting and northing by the resolution C({bool}). Returns: A `Utm` instance or if `Utm is None` a UtmUps5Tuple`(zone, hemipole, easting, northing, band)`.

Property Details

### band Get the latitudinal band (`str, 'A'|'B'..'Y'|'Z'`). Get method: band(self) - Get the latitudinal band (`str, 'A'|'B'..'Y'|'Z'`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### bandLatitude Get the band latitude (`degrees90` or `None`). Get method: bandLatitude(self) - Get the band latitude (`degrees90` or `None`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### datum Get the datum (Datum). Get method: datum(self) - Get the datum (Datum). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### en100k Get the 2-character grid EN digraph (`str`). Get method: en100k(self) - Get the 2-character grid EN digraph (`str`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### digraph Get the 2-character grid EN digraph (`str`). Get method: en100k(self) - Get the 2-character grid EN digraph (`str`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### easting Gets the easting (`meter`). Get method: easting(self) - Gets the easting (`meter`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### eastingnorthing Get easting and northing (EasNor2Tuple`(easting, northing)`). Get method: eastingnorthing(self) - Get easting and northing (EasNor2Tuple`(easting, northing)`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### northing Get the northing (`meter`). Get method: northing(self) - Get the northing (`meter`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### resolution Get the resolution (`meter`). Get method: resolution(self) - Get the resolution (`meter`). Set method: resolution(self, resolution) - Set the resolution of this Mgrs instance.

### zone Get the longitudal zone (`int`, 1..60). Get method: zone(self) - Get the longitudal zone (`int`, 1..60). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.