Constructor
new Mgrs(zone, band, e100k, n100k, easting, northing, datumopt)
Creates an Mgrs grid reference object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
zone |
number | 6° longitudinal zone (1..60 covering 180°W..180°E). | ||
band |
string | 8° latitudinal band (C..X covering 80°S..84°N). | ||
e100k |
string | First letter (E) of 100km grid square. | ||
n100k |
string | Second letter (N) of 100km grid square. | ||
easting |
number | Easting in metres within 100km grid square. | ||
northing |
number | Northing in metres within 100km grid square. | ||
datum |
LatLon.datums |
<optional> |
WGS84 | Datum UTM coordinate is based on. |
Methods
(static) parse(mgrsGridRef) → {Mgrs}
Parses string representation of MGRS grid reference.
An MGRS grid reference comprises (space-separated)
- grid zone designator (GZD)
- 100km grid square letter-pair
- easting
- northing.
Parameters:
Name | Type | Description |
---|---|---|
mgrsGridRef |
string | String representation of MGRS grid reference. |
Returns:
Mgrs grid reference object.
- Type
- Mgrs
Example
var mgrsRef = Mgrs.parse('31U DQ 48251 11932');
var mgrsRef = Mgrs.parse('31UDQ4825111932');
// mgrsRef: { zone:31, band:'U', e100k:'D', n100k:'Q', easting:48251, northing:11932 }
toString(digitsopt) → {string}
Returns a string representation of an MGRS grid reference.
To distinguish from civilian UTM coordinate representations, no space is included within the
zone/band grid zone designator.
Components are separated by spaces: for a military-style unseparated string, use
Mgrs.toString().replace(/ /g, '');
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
digits |
number |
<optional> |
10 | Precision of returned grid reference (eg 4 = km, 10 = m). |
Returns:
This grid reference in standard format.
- Type
- string
Example
var mgrsStr = new Mgrs(31, 'U', 'D', 'Q', 48251, 11932).toString(); // '31U DQ 48251 11932'
toUtm() → {Utm}
Converts MGRS grid reference to UTM coordinate.
Returns:
- Type
- Utm
Example
var mgrsRef = new Mgrs(31, 'U', 'D', 'Q', 448251, 11932);
var utmCoord = mgrsRef.toUtm(); // 31 N 448251 5411932