fromGeographicMeta static method

UtmMeta<Utm> fromGeographicMeta(
  1. Geographic geographic, {
  2. UtmZone? zone,
  3. Datum datum = Datum.WGS84,
  4. bool roundResults = true,
  5. bool verifyEN = true,
})

Creates projected UTM coordinates wrapped inside metadata object by converting it from a geographic position based on the datum.

The metadata includes UTM convergence and scale at the calculated projected position.

Set zone to specify a zone explicitely rather than using the zone within which the geographic position lies. Note that overriding the UTM zone has the potential to result in negative eastings, and strange results within Norway/Svalbard exceptions (you may need to set verifyEN to false when overriding the zone).

If roundResults is true (default), then the results are rounded to the reasonable precision, that is nm precision (1nm = 10^-14°).

Throws FormatException if coordinates are invalid (eg. latitude outside UTM limits).

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.

Examples:

  const geographic = Geographic(lat: 48.8582, lon: 2.2945);

  // UTM projected coordinates: 31 N 448252 5411933
  final utmMeta = Utm.fromGeographicMeta(geographic, datum: Datum.WGS84);
  final convergence = utmMeta.convergence;
  final scale = utmMeta.scale;

Implementation

//    final utmCoord = utmMeta.position;
///   final convergence = utmMeta.convergence;
///   final scale = utmMeta.scale;
/// ```
static UtmMeta<Utm> fromGeographicMeta(
  Geographic geographic, {
  UtmZone? zone,
  Datum datum = Datum.WGS84,
  bool roundResults = true,
  bool verifyEN = true,
}) {
  final result = geographicToUtm(
    lon: geographic.lon,
    lat: geographic.lat,
    elev: geographic.optElev,
    m: geographic.optM,
    zone: zone,
    datum: datum,
    roundResults: roundResults,
    to: Projected.new,
  );

  return UtmMeta._(
    Utm.from(
      result.zone,
      result.position,
      datum: datum,
      verifyEN: verifyEN,
    ),
    zone: result.zone,
    convergence: result.convergence,
    scale: result.scale,
  );
}