Function tryForwardUtm
Convert latitude and longitude to UTM easting and northing in metres.
bool tryForwardUtm(T)(
const GeographicCoordinate!T source,
const Ellipsoid!T ellipsoid,
out UtmCoordinate!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);
The function chooses the standard UTM zone and hemisphere for this position
and returns both with the projected coordinates. Use it for individual
positions when you do not know the zone in advance. For many positions
in one fixed zone, prepare and reuse UtmProjection!T instead.
Automatic conversion accepts latitudes from -80 degrees inclusive to +84 degrees exclusive and applies the Norway and Svalbard zone exceptions.
Parameters
| Name | Description |
|---|---|
| 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);