toPoint static method

List<double> toPoint(
  1. String mgrs
)

Convert MGRS to lat/lon.

Implementation

static List<double> toPoint(String mgrs) {
  if (mgrs == '') {
    throw Exception('toPoint received a blank string');
  }
  var utm = decode(mgrs.toUpperCase());
  utm.accuracy = null;
  var bbox = UTMtoLL(utm);
  if (bbox is LonLat) {
    return [bbox.lon, bbox.lat];
  } else if (bbox is BBox) {
    return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
  } else {
    throw Exception('Neither bbox, nor lonlat');
  }
}