# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# ecef2geodetic

Transform geocentric (ECEF) to geodetic coordinates

## Syntax

``````[lat,lon,h] = ecef2geodetic(spheroid,X,Y,Z)``````
``````[lat,lon,h] = ecef2geodetic(___,angleUnit)``````
``[lat,lon,h] = geodetic2ecef(X,Y,Z,spheroid)``

## Description

example

``````[lat,lon,h] = ecef2geodetic(spheroid,X,Y,Z)``` transforms point locations in geocentric Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates, stored in the coordinate arrays X, Y, and Z, to geodetic coordinates `lat` (geodetic latitude), `lon` (longitude), and `h` (ellipsoidal height). The geodetic coordinates refer to the reference body specified by the spheroid object, `spheroid`.```
``````[lat,lon,h] = ecef2geodetic(___,angleUnit)``` uses the character vector `angleUnit`, which matches either `'degrees'` or `'radians'`, to specify the units of the latitude and longitude coordinates.```
````[lat,lon,h] = geodetic2ecef(X,Y,Z,spheroid)` This syntax is supported but not recommended. This syntax returns `lat` and `lon` in radians. `spheroid` can be either a spheroid or an ellipsoid vector of the form: ` [semimajor_axis, eccentricity]`. `X`, `Y`, and `Z` must use the same units as the semimajor axis. In this case, `H` must use the same units as the semimajor axis.```

## Examples

collapse all

Convert the geocentric Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates for Paris, France into geodetic coordinates (latitude,longitude).

```x = 4.2010e+06; y = 1.7246e+05; z = 4.7801e+06; wgs84 = wgs84Ellipsoid('meters'); [lat,lon,h] = ecef2geodetic(wgs84,x,y,z)```
```lat = 48.8562 ```
```lon = 2.3508 ```
```h = 67.3700 ```

## Input Arguments

collapse all

Reference spheroid, specified as a `referenceEllipsoid`, `oblateSpheroid`, or `referenceSphere` object. To create a spheroid object, use the creation function specific to the object, or the `wgs84Ellipsoid` function.

Example: `spheroid = referenceEllipsoid('GRS 80');`

x-coordinates of one or more points in the spheroid-centric ECEF system, specified as a scalar value, vector, matrix, or N-D array. Values must be in units that match the `LengthUnit` property of the `spheroid` object.

Data Types: `single` | `double`

y-coordinates of one or more points in the spheroid-centric ECEF system, specified as a scalar value, vector, matrix, or N-D array. Values must be in units that match the `LengthUnit` property of the `spheroid` object.

Data Types: `single` | `double`

z-coordinates of one or more points in the spheroid-centric ECEF system, returned as a scalar value, vector, matrix, or N-D array. Units are determined by the `LengthUnit` property of the `spheroid` object.

Units of angles, specified as ‘degrees' (default), or 'radians'.

Data Types: `char`

## Output Arguments

collapse all

Geodetic latitudes of one or more points, returned as a scalar value, vector, matrix, or N-D array. Units are determined by the input argument `angleUnit`, if supplied; values are in degrees, otherwise. When in degrees, they lie in the closed interval [-90 90].

Longitudes of one or more points, returned as a scalar value, vector, matrix, or N-D array. Units are determined by the input argument `angleUnit`, if supplied; values are in degrees, otherwise. When in degrees, they lie in the interval [-180 180].

Ellipsoidal heights of one or more points, returned as a scalar value, vector, matrix, or N-D array. Units are determined by the `LengthUnit` property of the `spheroid` object

## Tips

• The geocentric Cartesian (ECEF) coordinate system is fixed with respect to the Earth, with its origin at the center of the spheroid and its positive X-, Y-, and Z axes intersecting the surface at the following points:

LatitudeLongitude Notes
X-axis00Equator at the Prime Meridian
Y-axis090Equator at 90-degrees East
Z-zxis900North Pole