Function TransverseMercator.tryForward
Project a geographic coordinate.
bool tryForward(
const GeographicCoordinate!T source,
out ProjectedCoordinate!T result
) const pure nothrow @nogc @safe;
Non-polar inputs are accepted only for |delta longitude| <= 60 degrees from the natural-origin meridian. Geographic poles are independent of source longitude. Output uses the ellipsoid linear unit.
Parameters
| Name | Description |
|---|---|
| source | Geographic source coordinate. |
| result | Receives projected easting and northing on success. |
Returns
true for a valid projection and supported, representable source;
otherwise false. On failure result is initialized to on entry and has no guaranteed value on failure.
Example
Example projecting a geographic coordinate without throwing.
import geodesy;
const projection = TransverseMercator!double .fromParameters(
wgs84!double(),
Latitude!double .fromDegrees(0.0),
Longitude!double .fromDegrees(15.0),
0.9996,
500_000.0,
0.0);
const source = GeographicCoordinate!double .fromComponents(
Latitude!double .fromDegrees(48.20849),
Longitude!double .fromDegrees(16.37208));
ProjectedCoordinate!double projected;
assert(projection .tryForward(source, projected));
assert(projected .easting > 500_000.0);