Function geodeticToGeocentric

Convert latitude, longitude and ellipsoidal height to Earth-centred XYZ.

GeocentricCoordinate!T geodeticToGeocentric(T)(
  const GeodeticCoordinate!T source,
  const Ellipsoid!T ellipsoid
) @safe
if (isGeodesyScalar!T);

Use this form when invalid input should raise an exception; use tryGeodeticToGeocentric to handle failure through a bool result.

Parameters

NameDescription
source Geodetic coordinate to convert.
ellipsoid Reference ellipsoid in the same linear unit as the height.

Returns

The finite geocentric Cartesian coordinate.

Throws

GeodesyValueException when the ellipsoid is invalid or no finite representable result can be produced.

Example

Example converting a geodetic position to ECEF.

import geodesy;
const source = GeodeticCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208),
    171.0);
const xyz = geodeticToGeocentric(source, wgs84!double());
assert(xyz.x > 0.0);