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=0, EN='', easting=0, northing=0, band='', datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran`...`, resolution=0, name='') New Mgrs Military grid reference. |
__str__(self) Default `str(self)`. |
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, fmt='[%s]', sep=', ', **prec) Return a string representation of this MGRS grid reference. |
toStr(self, prec=0, sep='') Return this MGRS grid reference as a string. |
toUps(self, Ups=<class 'pygeodesy.ups.Ups'>, center=False) Convert this MGRS grid reference to a UPS coordinate. |
toUtm(self, Utm=<class 'pygeodesy.utm.Utm'>, center=False) Convert this MGRS grid reference to a UTM coordinate. |
toUtmUps(self, Utm=<class 'pygeodesy.utm.Utm'>, Ups=<class 'pygeodesy.ups.Ups'>, center=False) Convert this MGRS grid reference to a UTM or UPS coordinate. |
Inherited from `named._NamedBase`: `__repr__`, `others` Inherited from `named._Named`: `__imatmul__`, `__matmul__`, `__rmatmul__`, `attrs`, `classof`, `copy`, `dup`, `methodname`, `rename`, `toStr2` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| band Get the latitudinal band `'C'|..|'X'` (no `'I'|'O'`) or polar region `'A'|'B'|'Y'|'Z'`) letter (`str`).
| bandLatitude Get the band latitude (`degrees90`).
| datum Get the datum (Datum).
| digraph DEPRECATED, use property `EN`.
| EN Get the 2-letter grid tile (`str`).
| en100k DEPRECATED, use property `EN`.
| easting Get the easting (`meter` within grid tile).
| eastingnorthing Get easting and northing (EasNor2Tuple`(easting, northing)`) within the MGRS grid tile, both in `meter`.
| isUPS Is this MGRS in a (polar) UPS zone (`bool`).
| isUTM Is this MGRS in a (non-polar) UTM zone (`bool`).
| northing Get the northing (`meter` within grid tile).
| northingBottom Get the northing of the band bottom (`meter`).
| resolution Get the MGRS resolution (`meter`, power of 10) or `0` if undefined.
| tilesize Get the MGRS grid tile size (`meter`).
| zone Get the longitudinal zone (`int`), 1..60 or 0 for polar.
| zoneB Get the polar region letter or the longitudinal zone digits plus latitudinal band letter (`str`).
Inherited from `named._Named`: `classname`, `classnaming`, `iteration`, `name`, `named`, `named2`, `named3`, `named4`, `sizeof` Inherited from `object`: `__class__`

Method Details

### __init__ (self, zone=0, EN='', easting=0, northing=0, band='', datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran`...`, resolution=0, name='') (Constructor) |
New Mgrs Military grid reference. Arguments: `zone` - The 6° longitudinal zone (`int`), 1..60 covering 180°W..180°E or `0` for polar regions or (`str`) with the zone number and latitudinal band letter. `EN` - Two-letter EN digraph (`str`), grid tile using only the AA aka MGRS-New (row) lettering scheme. `easting` - Easting (`meter`), within 100 Km grid tile. `northing` - Northing (`meter`), within 100 Km grid tile. `band` - Optional, latitudinal band or polar region letter (`str`), 'C'|..|'X' covering 80°S..84°N (no 'I'|'O'), 'A'|'B' at the south or 'Y'|'Z' at the north pole. `datum` - This reference's datum (Datum, Ellipsoid, Ellipsoid2 or a_f2Tuple). `resolution` - Optional resolution (`meter`), `0` for default. `name` - Optional name (`str`). Raises: `MGRSError` - Invalid `zone`, `EN`, `easting`, `northing`, `band` or `resolution`. `TypeError` - Invalid `datum`. Overrides: object.__init__

### __str__ (self) (Informal representation operator) |
Default `str(self)`. Overrides: object.__str__ (inherited documentation)

### 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 (`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, gamma, 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, fmt='[%s]', sep=', ', **prec) |
Return a string representation of this MGRS grid reference. Arguments: `fmt` - Enclosing backets format (`str`). `sep` - Separator between name:values (`str`). `prec` - Precision (`int`), see method Mgrs.toStr. Returns: This Mgrs as "[Z:[dd]B, G:EN, E:easting, N:northing]" (`str`), with `sep ", "`. Raises: `ValueError` - Invalid `prec`. Overrides: named._Named.toRepr Note: MGRS grid references are truncated, not rounded (unlike UTM/UPS coordinates).

### toStr (self, prec=0, sep='') |
Return this MGRS grid reference as a string. Arguments: `prec` - Precision, the number of decimal digits (`int`) or if negative, the number of units to drop, like MGRS PRECISION. `sep` - Optional separator to join (`str`) or `None` to return an unjoined 3-`tuple` of `str`s. Returns: This Mgrs as 4-tuple `("dd]B", "EN", "easting", "northing")` if `sep=NN` or "[dd]B EN easting northing" (`str`) with `sep " "`. Raises: `ValueError` - Invalid `prec`. Overrides: named._Named.toStr Notes: Both `easting` and `northing` strings are `NN` or missing if `prec <= -5`. MGRS grid references are truncated, not rounded (unlike UTM/UPS).

### toUps (self, Ups=<class 'pygeodesy.ups.Ups'>, center=False) |
Convert this MGRS grid reference to a UPS coordinate. Arguments: `Ups` - Optional class to return the UPS coordinate (Ups) or `None`. `center` - Optionally, center easting and northing by the resolution (`bool`). Returns: A `Ups` instance or if `Ups is None` a UtmUps5Tuple`(zone, hemipole, easting, northing, band)`. Raises: `MGRSError` - This MGRS is a non-polar UTM reference.

### 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 (`bool`). Returns: A `Utm` instance or if `Utm is None` a UtmUps5Tuple`(zone, hemipole, easting, northing, band)`. Raises: `MGRSError` - This MGRS is a polar UPS reference.

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

Property Details

### band Get the latitudinal band `'C'|..|'X'` (no `'I'|'O'`) or polar region `'A'|'B'|'Y'|'Z'`) letter (`str`). Get method: band(self) - Get the latitudinal band `'C'|..|'X'` (no `'I'|'O'`) or polar region `'A'|'B'|'Y'|'Z'`) letter (`str`). 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`). Get method: bandLatitude(self) - Get the band latitude (`degrees90`). 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.

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

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

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

### easting Get the easting (`meter` within grid tile). Get method: easting(self) - Get the easting (`meter` within grid tile). 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)`) within the MGRS grid tile, both in `meter`. Get method: eastingnorthing(self) - Get easting and northing (EasNor2Tuple`(easting, northing)`) within the MGRS grid tile, both in `meter`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### isUPS Is this MGRS in a (polar) UPS zone (`bool`). Get method: isUPS(self) - Is this MGRS in a (polar) UPS zone (`bool`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### isUTM Is this MGRS in a (non-polar) UTM zone (`bool`). Get method: isUTM(self) - Is this MGRS in a (non-polar) UTM zone (`bool`). 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` within grid tile). Get method: northing(self) - Get the northing (`meter` within grid tile). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

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

### resolution Get the MGRS resolution (`meter`, power of 10) or `0` if undefined. Get method: resolution(self) - Get the MGRS resolution (`meter`, power of 10) or `0` if undefined. Set method: resolution(self, resolution) - Set the MGRS resolution (`meter`, power of 10) or `0` to undefine and disable UPS/UTM centering.

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

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

### zoneB Get the polar region letter or the longitudinal zone digits plus latitudinal band letter (`str`). Get method: zoneB(self) - Get the polar region letter or the longitudinal zone digits plus latitudinal band letter (`str`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.