Function UtmProjection.tryForward

Project a geographic coordinate in this explicit UTM zone.

bool tryForward(
  const GeographicCoordinate!T source,
  out ProjectedCoordinate!T result
) const pure nothrow @nogc @safe;

The automatic -80/+84 degree UTM latitude band is not reapplied and zone/hemisphere are not recomputed. The delegated bounded Transverse Mercator domain remains authoritative.

Parameters

NameDescription
source Geographic source coordinate.
result Receives easting and northing in metres on success.

Returns

true when this projection is valid and delegated TM projection succeeds; otherwise false. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example projecting in a prepared UTM zone without throwing.

import geodesy;
const projection = UtmProjection!double.fromZone(
    wgs84!double(), UtmZone.fromNumber(33), UtmHemisphere.north);
const vienna = GeographicCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208));
ProjectedCoordinate!double result;
assert(projection.tryForward(vienna, result));
assert(result.easting > 0.0);