function [lat, lon, h] = aer2geodetic( ...
    az, elev, slantRange, lat0, lon0, h0, spheroid, angleUnit)
%

% Copyright 2012-2023 The MathWorks, Inc.

%#codegen

inDegrees = (nargin < 8 || map.geodesy.isDegree(angleUnit));

[x, y, z] = aer2ecefFormula( ...
    az, elev, slantRange, lat0, lon0, h0, spheroid, inDegrees);

if inDegrees
    [lat, lon, h] = ecef2geodetic(spheroid, x, y, z);
else
    [lat, lon, h] = ecef2geodetic(spheroid, x, y, z, 'radian');
end
