Function File: X, Y, Z = geodetic2ecef (lat, lon, alt)
Function File: X, Y, Z = geodetic2ecef (spheroid, lat, lon, alt)
Function File: X, Y, Z = geodetic2ecef (…, angleUnit)
Function File: X, Y, Z = geodetic2ecef (lat, lon, alt, spheroid)

Convert from geodetic coordinates to Earth Centered Earth Fixed (ECEF) coordinates.

Inputs:

  • spheroid ia user-specified sheroid (see referenceEllipsoid); it can be omitted or given as an ampty string, in which case WGS84 will be the default spheroid. Unfortunately EPSG numbers cannot be accepted.

    Inputting spheroid as 4th argument is accepted but not recommended; in that case the lat and lon inputs are required to be in radians.

  • lat, lon (both angle) and alt (length) are latitude, longitude and height, respectively and can each be scalars. Vectors or nD arrays are accepted but must all have the exact same size and dimension(s). alt’s length unit is that of the invoked reference ellipsoid, whose default is meters. For the default angle unit see below.

    Note: height is relative to the reference ellipsoid, not the geoid. Use e.g., egm96geoid to compute the height difference between the geoid and the WGS84 reference ellipsoid.

  • angleUnit can be "degrees" (= default) or "radians". The default is degrees, unless spheroid was given as as 4th input argument in which case angleUnit is in radians and cannot be changed.

Ouputs:

  • The output arguments X, Y, Z (Earth-Centered Earth Fixed coordinates) are in the length units of the invoked ellipsoid and have the same sizes and dimensions as input arguments lat, lon and alt.

Example:

Aalborg GPS Centre
lat=57.02929569;
lon=9.950248114;
h= 56.95; # meters
>> [X, Y, Z] = geodetic2ecef ("", lat, lon, h)
X =     3426949.39675307
Y =     601195.852419885
Z =     5327723.99358255

See also: ecef2geodetic, geodetic2aer, geodetic2enu, geodetic2ned, egm96geoid, referenceEllipsoid.

Package: mapping