Function UtmCoordinate.tryFromComponents

Construct a tagged UTM coordinate without throwing.

static bool tryFromComponents(
  const UtmZone zone,
  const UtmHemisphere hemisphere,
  const T easting,
  const T northing,
  out UtmCoordinate result
) pure nothrow @nogc @safe;

Parameters

NameDescription
zone Valid UTM zone.
hemisphere North/south false-northing convention.
easting Finite easting in metres.
northing Finite northing in metres.
result Receives the tagged coordinate on success.

Returns

true for structurally valid input; otherwise false. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example checking a tagged UTM coordinate without throwing.

import geodesy;
UtmCoordinate!double coordinate;
assert(UtmCoordinate!double.tryFromComponents(
    UtmZone.fromNumber(33), UtmHemisphere.north,
    500_000.0, 5_340_000.0, coordinate));
assert(coordinate.isValid);