Function GeodeticCoordinate.tryFromComponents
Make a latitude/longitude/height position without throwing.
static bool tryFromComponents(
const Latitude!T latitude,
const Longitude!T longitude,
const T ellipsoidalHeight,
out GeodeticCoordinate result
) pure nothrow @nogc @safe;
Use this checked factory when the height comes from data that may be invalid. A height of zero means exactly zero above the ellipsoid; it does not mean that the height is unknown.
Parameters
| Name | Description |
|---|---|
| latitude | Geodetic latitude. |
| longitude | Geodetic longitude. |
| ellipsoidalHeight | Finite height in the caller-selected linear unit. |
| result | Receives the constructed coordinate on success. |
Returns
true on success; false when ellipsoidalHeight is NaN or
infinite. On failure, the out result remains (the out parameter is initialized on entry).
Example
Example checking a geodetic coordinate without throwing.
import geodesy;
GeodeticCoordinate!double point;
assert(GeodeticCoordinate!double .tryFromComponents(
Latitude!double .fromDegrees(48.0),
Longitude!double .fromDegrees(16.0),
171.0,
point));
assert(point .ellipsoidalHeight == 171.0);