# Earth Coordinates

## Cartesian Coordinate System

The usual cartesian coordinate system associated with the Earth is specified as follows:

- The origin is the center of the Earth.
- The z-axis is the rotational axis. It pierces the Earth at the poles and its positive direction is towards the north pole. The Earth rotates in the positive direction around this z-axis: when you lay your right hand on the globe such that the thumb shows to the north pole, then the Earth rotates in the direction of the fingers ("the rule of the right hand").
- Great circles passing through the poles are called meridians. The
*prime meridian*pass through Greenwich (London). - The plane that is orthogonal to the z-axis is the equatorial plane and the great circle that is located in this plane is the equator.
- The x-axis points towards the intersection of the prime meridian with the equator.
- The y-axis is in the equator plane, it is orthogonal to the x-axis and oriented such that the coordinates build a right-handed system. When the fingers of the right hand go from the x- to the y-axis then the thumb shows in the direction of the z-axis.

Each point on the Earth is uniquely defined by its cartesian coordinates (x, y, z). In fact, only 2 coordinates would suffice because each point is on the surface of a sphere:

^{2}+ y

^{2}+ z

^{2}= R

^{2}

where *R* is the Earth's radius, *R* = 6371.010 km.

Since this cartesian coordinate system is fixed with the Earth,
it is call *Earth-centered Earth-fixed* (ECEF) system.

## Spherical Coordinate System

Points on the Earth are usually specified in the spherical coordinate system.

The spherical coordinates of an arbitrary cartesian point *P(x, y, z)* are:

- The latitude
*φ*which is the angle between*OP*and the equator. - The longitude
*λ*which is the angle between the prime meridian and the meridian passing through*OP*. - The radius
*r*which is the distance of*P*from the origin.

Since the radius is constant, the two angles (*φ, λ*) are
already sufficient to specify a point on the Earth:

The longitude at the poles is arbitrary and is usually set to 0° by convention.

We can easily find the relation between the cartesian and spherical coordinates.
Let *P(x, y, z)* be a cartesian point, and *P'* its projection
on the x/y-plane. The length OP' is

We can now compute the cartesian coordinates from the spherical coordinates:

Solving these equations for (*φ, λ, r*) yields the opposite
relationship:

^{2}+ y

^{2}+ z

^{2}

Here, the simple minded *λ* = arctan(*y/x*), which is valid only
for -90° < λ < 90°, was replaced by the correct atan2(*y, x*),
which yields -180° < λ ≤ 180°.

## Geodetic Coordinate System

The spherical coordinate system is closely related to the *geodetic system*.
In the geodetic system, the points are specified by latitude, longitude and
elevation (height *h*). The elevation is measured orthogonal to a reference surface
which is usually the earth ellipsoid. When we approximate the earth by a sphere with
radius *R*, then

## ENU Coordinate System

The ENU coordinate system is a local system specific to any point *P*
on the Earth. It is formed from a plane tangent to
the Earth's surface at the point *P*. In this plane:

- the unit vector
points to the East**E** - the unit vector
points to the North**N** - the unit vector
points Up, i.e. is orthogonal to the tangent plane.**U**

The practical ENU coordinate system is used e.g. by Google Earth and other targeting and tracking applications.

The vector * E = (E_{x}, E_{y}, E_{z})*
is tangent to the circle of constant latitude passing through

*P*. This circle is also called a "parallel circle" because it is parallel to the equator. The tangent is obtained by taking partial derivatives of the expressions (4) with respect to

*λ*and normalizing the resulting vector to the length 1:

_{x}= - sin λ.

_{y}= cos λ.

_{z}= 0.

The vector * N = (N_{x}, N_{y}, N_{z})*
is tangent to the meridian circle passing through

*P*. So, by taking partial derivatives of the expressions (4) with respect to

*φ*and normalizing the resulting vector to the length 1 we get:

_{x}= - sin(φ) cos(λ).

_{y}= - sin(φ) sin(λ).

_{z}= cos(φ).

The unit vector * U = (U_{x}, U_{y}, U_{z})*
points in the direction of

*P*. So, by setting

*r*= 1 in the expressions (4), we get:

_{x}= cos(φ) cos(λ).

_{y}= cos(φ) sin(λ).

_{z}= sin(φ).

## Transforming ENU to ECEF

Let us consider a point *Q* that has the coordinates *(x, y, z)*
in the ECEF system and coordinates *Q' = (e, n, u)* in the ENU system
located at *P* = *(P _{x}, P_{y}, P_{z})*.
The spherical coordinates of

*P*are

*(φ, λ, R)*. Then the following equation transforms

*(e, n, u)*to

*(x, y, z)*:

x | -sin(λ) | -sin(φ) cos(λ) | cos(φ) cos(λ) | e | P_{x} | ||||||||||||

y | = | cos(λ) | -sin(φ) sin(λ) | cos(φ) sin(λ) | n | + | P_{y} | (10) | |||||||||

z | 0 | cos(φ) | sin(φ) | u | P_{z} |

Notice that the columns of the transformation matrix * M*
are equal to the vectors

*,*

**E***,*

**N***, respectively. Hence, the matrix*

**U***is orthonormal. It corresponds to the rotation of the XYZ-System around the origin into the ENU-System (centered at origin). The transformation is built by first rotating the vectors*

**M***,*

**X***,*

**Y***around the origin into*

**Z***,*

**E***,*

**N***, and then translating this system by the vector*

**U***into its final position.*

**P**The transformation can be written concisely using vector and matrix notation:

**Q**=

**M**

**Q'**+

**P**

## Transforming ECEF to ENU

The transformation from ECEF to ENU is obtained by inverting the transformation (11):

**Q'**=

**M**(

^{-1}**Q**-

**P**) =

**M**(

^{T}**Q**-

**P**)

Here we used the fact that the inverse of an orthonormal matrix is equal to the transformed matrix. This equation is in explicit terms as follows:

e | -sin(λ) | cos(λ) | 0 | x - P_{x} | |||||||||

n | = | -sin(φ) cos(λ) | -sin(φ) sin(λ) | cos(φ) | y - P_{y} | (13) | |||||||

u | cos(φ) cos(λ) | cos(φ) sin(λ) | sin(φ) | z - P_{z} |

Let me recall that this equation transforms the XYZ-coordinates *(x, y, z)*
of an arbitrary point *Q* into its ENU-coordinates *(e, n, u)*.
The ENU system is
located at the point *P* with XYZ-coordinates
*(P _{x}, P_{y}, P_{z})* and
XYZ-spherical coordinates

*(φ, λ, R)*.

A thoughtful reader surely noticed an asymmetry in the respective transformations (11) and (12), even if they both express rotations and translations. This apparent problem is resolved as follows. The equation (12) can be written as:

**Q'**=

**M**

^{-1}**Q**-

**M**

^{-1}**P**

The meaning is that the ENU system is first rotated around its origin at *P*
by the inverse rotation such that its axes are parallel to the XYZ-system.
Afterwards it is translated by the vector * M^{-1} P*
such that its origin is moved to the origin

*of the XYZ-system. Indeed, the expression*

**O***denotes the origin*

**M**^{-1}**P***of the XYZ-system expressed in the ENU-system, as we can see by applying the equation (14) to the point*

**O**= (0, 0, 0)^{T}*:*

**O**= (0, 0, 0)^{T}**O'**=

**M**

^{-1}**O**-

**M**

^{-1}**P**= -

**M**

^{-1}**P**

So, the equations (12) or (14), respectively, can be written as:

**Q'**=

**M**

^{-1}**Q**+

**O'**

which is completely symmetric to the equation (11). For computational purposes the equations (12) (respectively (13)) are preferable.