Function geodeticToGeocentric

Throwing convenience wrapper for tryGeodeticToGeocentric.

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

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);