Function TransverseMercator.tryFromParameters

Set up a custom Transverse Mercator grid without throwing.

static bool tryFromParameters(
  const Ellipsoid!T ellipsoid,
  const Latitude!T latitudeOfNaturalOrigin,
  const Longitude!T longitudeOfNaturalOrigin,
  const T scaleFactorAtNaturalOrigin,
  const T falseEasting,
  const T falseNorthing,
  out TransverseMercator result
) pure nothrow @nogc @safe;

Supply the ellipsoid, natural origin, local scale and grid offsets specified by your coordinate system. Easting/northing offsets must use the same linear unit as the ellipsoid. A positive scale factor is required. Use UtmProjection for a standard UTM zone instead.

Parameters

NameDescription
ellipsoid Valid spherical or oblate ellipsoid with flattening 0 <= f <= 0.01; its semi-major axis defines the linear unit.
latitudeOfNaturalOrigin EPSG 8801 latitude of natural origin.
longitudeOfNaturalOrigin EPSG 8802 longitude of natural origin.
scaleFactorAtNaturalOrigin Finite positive EPSG 8805 scale factor.
falseEasting Finite EPSG 8806 false easting in the ellipsoid linear unit.
falseNorthing Finite EPSG 8807 false northing in the same linear unit.
result Receives the prepared projection on success.

Returns

true when all parameters and derived constants are supported and representable; otherwise false. On failure result remains unchanged.

Example

Example preparing Transverse Mercator without throwing.

import geodesy;
TransverseMercator!double projection;
assert(TransverseMercator!double.tryFromParameters(
    wgs84!double(),
    Latitude!double.fromDegrees(0.0),
    Longitude!double.fromDegrees(15.0),
    0.9996,
    500_000.0,
    0.0,
    projection));
assert(projection.isValid);