File Exchange

## Covert lat, lon, alt to ECEF Cartesian

version 1.0.0.0 (671 Bytes) by
Convert latitude, longitude,altitude to earth-centered, earth-fixed (ECEF) cartesian coordinate.

Updated 01 Jul 2005

LLA2ECEF - convert latitude, longitude, and altitude to earth-centered, earth-fixed (ECEF) cartesian coordinates

USAGE:
[x,y,z] = lla2ecef(lat,lon,alt)

x = ECEF X-coordinate (m)
y = ECEF Y-coordinate (m)
z = ECEF Z-coordinate (m)
alt = height above WGS84 ellipsoid (m)

Notes: This function assumes the WGS84 model. Latitude is customary geodetic (not geocentric).

Source: "Department of Defense World Geodetic System 1984," Page 4-4. National Imagery and Mapping Agency. NIMA TR8350.2

Michael Kleder, July 2005

### Cite As

Michael Kleder (2021). Covert lat, lon, alt to ECEF Cartesian (https://www.mathworks.com/matlabcentral/fileexchange/7942-covert-lat-lon-alt-to-ecef-cartesian), MATLAB Central File Exchange. Retrieved .

Michael Thew

@Tim Hollenshade you must use radians, not degrees. then it works :)

gareth lloyd

For example, the following latitude, longitude coordinate along with a nominal 550m elevation (roughly, Munich Germany)
... returns
x = 4.1780e+06
y = 8.5575e+05
z = 4.7275e+06

IIT

Iam getting the following error
(Too many output arguments). Why is that so ? What should i do to get out from that ?

sidharhda puttala

This function's output does not match the output of the Aerospace Toolbox's 'lla2ecef' function output...

MIKE RANTOS

hALLO

erwin junaidi

thanks

King Dong

P. McNamara

KiRyong Kang

Jim Gottwald

Both ecef2lla.m and lla2ecef.m are excellent algorithms. I tested these algorithms with the Satellite Tool Kit using LLA data for 8 cities around the world. Lat and long conversions are accurate to at least 4 decimal places. Altitude conversions are accurate to within 0.01 meters. ECEF conversions are generally accurate to within 0.03 meters.

Thanks for making these available!

##### MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
##### Platform Compatibility
Windows macOS Linux