Utm.from constructor

Utm.from(
  1. UtmZone utmZone,
  2. Projected projected, {
  3. Datum datum = Datum.WGS84,
  4. bool verifyEN = true,
})

Creates UTM coordinates from utmZone and the projected position based on the datum.

Easting is in metres from the false easting (-500km from the central meridian).

Northing is in metres from the equator (N) or from the false northing -10,000km (S).

2D positions are constructed as Projected(x: easting, y: northing) and 3D positions as Projected(x: easting, y: northing, z: elev).

The datum indicates the geodetic reference (ie. ellipsoid and other parameters) used when projecting geographic coordinates to projected coordinates.

Use datum to set the datum for calculations with a reference ellipsoid and datum transformation parameters.

If verifyEN is true it's validated that easting/northing is within 'normal' values (may be suppressed for extended coherent coordinates or alternative datums e.g. ED50, see epsg.io/23029). The 'normal' values are roughly 0..1000000m for easting, and 0..9329006m for northing in the northern hemisphere and 1116914..10000000m in the southern hemisphere.

May throw a FormatException if the UTM zone, hemisphere, easting or northing are invalid.

Examples:

  // UTM coordinates with 2D position in zone 31N and WGS84 datum
  // (easting 448251.0, northing 5411932.0).
  final utmCoord =
      Utm.from(UtmZone(31, 'N'), Projected(x: 448251.0, y: 5411932.0));

Implementation

factory Utm.from(
  UtmZone utmZone,
  Projected projected, {
  Datum datum = Datum.WGS84,
  bool verifyEN = true,
}) {
  if (verifyEN) {
    _verifyEN(projected, utmZone.hemisphere);
  }

  return Utm._coordinates(utmZone, projected, datum: datum);
}