Function TopocentricFrame.tryGeodeticToTopocentric

Convert a geodetic coordinate directly to local East/North/Up.

bool tryGeodeticToTopocentric(
  const GeodeticCoordinate!T source,
  out TopocentricCoordinate!T result
) const pure nothrow @nogc @safe;

Implements EPSG coordinate operation method 9837 as the composition of EPSG 9602 forward and EPSG 9836 forward.

The complete composed calculation remains in the prepared working scalar. For float, the represented public geodetic values are promoted to double before Earth-scale ECEF coordinates are computed. No GeocentricCoordinate!float intermediate is materialized.

Parameters

NameDescription
source Geodetic coordinate whose height uses the frame linear unit.
result Receives local East/North/Up on success.

Returns

true when composed EPSG 9837 succeeds with a finite representable result; otherwise false. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example converting a geodetic position to ENU without throwing.

import geodesy;
const origin = GeodeticCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208),
    171.0);
const frame = TopocentricFrame!double.fromGeodeticOrigin(
    wgs84!double(), origin);
const nearby = GeodeticCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20850),
    Longitude!double.fromDegrees(16.37210),
    175.0);
TopocentricCoordinate!double local;
assert(frame.tryGeodeticToTopocentric(nearby, local));
assert(local.east == local.east);