Function tryForwardUtm

Project a geographic coordinate using standard automatic UTM zone and hemisphere policy.

bool tryForwardUtm(T)(
  const GeographicCoordinate!T source,
  const Ellipsoid!T ellipsoid,
  out UtmCoordinate!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

The accepted automatic latitude domain is -80 degrees inclusive to +84 degrees exclusive. Zone selection applies the Norway and Svalbard exceptions. This convenience operation prepares the selected zone per call; bulk callers in a known zone should reuse UtmProjection!T.

Parameters

NameDescription
source Geographic source coordinate.
ellipsoid Supported terrestrial oblate ellipsoid in metres.
result Receives tagged UTM zone, hemisphere, easting, and northing.

Returns

true when automatic policy selection and projection succeed.

Example

Example using bool tryForwardUtm(T)( const GeographicCoordinate!T source, const Ellipsoid!T ellipsoid, out UtmCoordinate!T.

import geodesy;

const vienna = GeographicCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208));

const utm = vienna.forwardUtm(wgs84!double());
assert(utm.zone.number == 33);
assert(utm.hemisphere == UtmHemisphere.north);

const back = utm.reverseUtm(wgs84!double());
assert(back.latitude.degrees > 48.0);