MgrsGridZone constructor
Creates a MGRS grid zone with lonZone
and band
.
The lonZone
represents UTM 6° longitudinal zone (1..60 covering
180°W..180°E).
The band
represents 8° latitudinal band (C..X covering 80°S..84°N).
Throws a FormatException if MGRS zone or band is invalid.
Examples:
// MGRS grid zone with zone 31 and band U.
final mgrsGridZone = MgrsGridZone(31, 'U');
Implementation
factory MgrsGridZone(int lonZone, String band) {
// validate zone
if (!(1 <= lonZone && lonZone <= 60)) {
throw FormatException('invalid MGRS longitudinal zone $lonZone');
}
// validate band
if (band.length != 1 || !_latBands.contains(band)) {
throw FormatException('invalid MGRS band `$band`');
}
return MgrsGridZone._coordinates(
lonZone,
band,
);
}