Mgrs class

Military Grid Reference System (MGRS/NATO) grid references, with methods to parse references, and to convert between MGRS references and UTM coordinates.

MGRS grid references provide geocoordinate references covering the entire globe, based on the UTM projection.

MGRS grid references comprise a grid zone designator (GZD) like 31U (see MgrsGridZone), a 100km square identification like DQ (see MgrsGridSquare), and an easting and northing (in metres); e.g. ‘31U DQ 48251 11932’.

Depending on requirements, some parts of the reference may be omitted (implied), and eastings/northings may be given to varying resolution.

See also Military Grid Reference System in Wikipedia for more information.

Other refererences:

Annotations
  • @immutable

Constructors

Mgrs.new(int lonZone, String band, String column, String row, int easting, int northing, {Datum datum = Datum.WGS84})
Creates a MGRS grid reference with lonZone, band, column, row, easting, northing based on the datum (used in the UTM projection).
factory
Mgrs.fromUtm(Utm utm)
Creates a MGRS grid reference from projected UTM coordinates.
factory
Mgrs.parse(String text, {Datum datum = Datum.WGS84})
Parses a MGRS grid reference from a text string like '31U DQ 48251 11932'.
factory

Properties

datum Datum
The datum used for calculations with a reference ellipsoid and datum transformation parameters.
final
easting int
The easting (x) in metres within a 100km grid square.
final
gridSquare MgrsGridSquare
The 100km grid square identified by a grid zone designator (GZD) and a 100km square identification.
final
hashCode int
The hash code for this object.
no setteroverride
northing int
The northing (y) in metres within a 100km grid square.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
toText({int digits = 10, bool militaryStyle = false, bool zeroPadZone = false}) String
The MGRS grid reference string representation with components separated by whitespace by default.
toUtm() Utm
Converts this MGRS grid reference to the UTM projected coordinates.

Operators

operator ==(Object other) bool
The equality operator.
override