Struct GeodeticCoordinate
A geodetic position represented by strong latitude and longitude values and finite ellipsoidal height.
struct GeodeticCoordinate(T)
if (isGeodesyScalar!T);
The linear unit of ellipsoidalHeight is not encoded in the type. When
used with an ellipsoid, the height and ellipsoid axes must use the same
linear unit. No datum, CRS, or ellipsoid identity is embedded.
represents latitude zero, longitude zero, and zero ellipsoidal
height. Checked construction returns false for non-finite height;
throwing construction reports the same failure with
GeodesyValueException.
Properties
| Name | Type | Description |
|---|---|---|
ellipsoidalHeight[get]
|
T | Ellipsoidal height in the operation's linear unit. |
latitude[get]
|
Latitude!T | Geodetic latitude. |
longitude[get]
|
Longitude!T | Geodetic longitude. |
Methods
| Name | Description |
|---|---|
fromComponents
(latitude, longitude, ellipsoidalHeight)
|
Make a latitude/longitude position with ellipsoidal height. |
tryFromComponents
(latitude, longitude, ellipsoidalHeight, result)
|
Make a latitude/longitude/height position without throwing. |
Example
Example constructing and validating a geodetic coordinate.
import geodesy;
const vienna = GeodeticCoordinate!double .fromComponents(
Latitude!double .fromDegrees(48.20849),
Longitude!double .fromDegrees(16.37208),
171.0);
assert(vienna .ellipsoidalHeight == 171.0);
GeodeticCoordinate!double checked;
assert(!GeodeticCoordinate!double .tryFromComponents(
vienna .latitude, vienna .longitude, double .nan, checked));
Example
Regression
unsuccessful checked geodetic construction resets the out parameter.
import geodesy;
auto result = GeodeticCoordinate!double .fromComponents(
Latitude!double .fromDegrees(48.0),
Longitude!double .fromDegrees(16.0), 171.0);
assert(!GeodeticCoordinate!double .tryFromComponents(
Latitude!double .fromDegrees(48.0),
Longitude!double .fromDegrees(16.0), double .nan, result));
assert(result .latitude .degrees == 0.0);
assert(result .longitude .degrees == 0.0);
assert(result .ellipsoidalHeight == 0.0);