Converting Between ECEF and ECI Coordinate Systems
Learn how to convert coordinates between Earth-Centered Earth-Fixed (ECEF) and Earth-Centered Inertial (ECI) reference frames. Understand the role of Earth's rotation and sidereal time.
Table of Contents
Converting between ECEF (Earth-Centered Earth-Fixed) and ECI (Earth-Centered Inertial) coordinate systems is a fundamental operation in satellite tracking and space applications. While both systems share the same origin at Earth’s center, they differ in one crucial aspect: rotation.
Quick Recap: ECI vs ECEF
ECI (Earth-Centered Inertial)
- Axes: Fixed relative to distant stars
- X-axis: Points toward vernal equinox
- Z-axis: Points toward celestial north pole
- Rotation: None—axes remain stationary in space
- Used for: Orbital mechanics, satellite propagation
ECEF (Earth-Centered Earth-Fixed)
- Axes: Rotate with Earth
- X-axis: Points toward 0° longitude (Prime Meridian)
- Z-axis: Points toward geographic north pole
- Rotation: Completes one revolution per sidereal day
- Used for: GPS, ground stations, mapping
The key insight: ECEF rotates relative to ECI at the rate of Earth’s rotation.
Why Convert Between Them?
| Scenario | From | To | Reason |
|---|---|---|---|
| Satellite tracking | ECI (from SGP4) | ECEF | Calculate ground track |
| Ground station pointing | ECEF (station location) | ECI | Point antenna at satellite |
| GPS positioning | ECEF (receiver) | ECI | Compare with satellite orbit |
| Orbit determination | ECEF (radar observation) | ECI | Fit orbital elements |
The Core Concept: Earth’s Rotation
The conversion between ECI and ECEF is fundamentally a rotation about the Z-axis by the angle θ, where θ represents how much Earth has rotated since the ECI X-axis (vernal equinox) aligned with the ECEF X-axis (Prime Meridian).
This angle is called the Greenwich Mean Sidereal Time (GMST) or, for higher precision, Greenwich Apparent Sidereal Time (GAST).
ECI Frame (fixed) ECEF Frame (rotating)
Y Y'
↑ ↑
| /
| / θ (GMST)
| /
+----→ X +----→ X'
/ /
↓ ↓
Z (same) Z' (same)
Sidereal Time Explained
What is Sidereal Time?
A sidereal day is the time it takes Earth to complete one rotation relative to distant stars—approximately 23 hours, 56 minutes, and 4 seconds.
This differs from a solar day (24 hours) because Earth also moves along its orbit around the Sun, requiring an extra ~4 minutes of rotation each day to face the Sun again.
Greenwich Mean Sidereal Time (GMST)
GMST is the angle between the vernal equinox and the Prime Meridian, measured at the Greenwich observatory. It increases continuously as Earth rotates.
GMST at J2000.0 epoch (January 1, 2000, 12:00 TT):
θ₀ = 280.46061837°
Rate of change:
ω = 360.98564736629° per day
Calculating GMST
GMST (degrees) = θ₀ + ω × d + higher-order terms
Where:
d = Julian days since J2000.0
θ₀ = 280.46061837°
ω = 360.98564736629°/day
For higher precision, additional terms account for precession and Earth’s orbital variations.
The Conversion Mathematics
ECI to ECEF
To convert from ECI to ECEF, rotate by negative GMST (clockwise when viewed from above the north pole):
┌ ┐ ┌ ┐ ┌ ┐
│ X_ecef │ │ cos(θ) sin(θ) 0 │ │ X_eci │
│ Y_ecef │ = │ -sin(θ) cos(θ) 0 │ × │ Y_eci │
│ Z_ecef │ │ 0 0 1 │ │ Z_eci │
└ ┘ └ ┘ └ ┘
Where θ = GMST (in radians)
The Z component remains unchanged because both frames share the same Z-axis (Earth’s rotation axis).
ECEF to ECI
To convert from ECEF to ECI, rotate by positive GMST (counterclockwise):
┌ ┐ ┌ ┐ ┌ ┐
│ X_eci │ │ cos(θ) -sin(θ) 0 │ │ X_ecef │
│ Y_eci │ = │ sin(θ) cos(θ) 0 │ × │ Y_ecef │
│ Z_eci │ │ 0 0 1 │ │ Z_ecef │
└ ┘ └ ┘ └ ┘
This is simply the transpose (inverse) of the ECI-to-ECEF rotation matrix.
Including Velocity
For velocity vectors, the same rotation applies, but you must also account for the rotational velocity of the ECEF frame:
V_ecef = R(θ) × V_eci - ω × R_ecef
Where:
ω = Earth's angular velocity vector = [0, 0, 7.292115×10⁻⁵] rad/s
× = cross product
The cross product term represents the velocity contribution from Earth’s rotation at the position R_ecef.
Step-by-Step Example
Let’s convert an ISS position from ECI to ECEF.
Given (ECI coordinates at a specific time):
Time: 2024-01-15 12:00:00 UTC
X_eci = -4453.783 km
Y_eci = 5038.203 km
Z_eci = -2878.965 km
Step 1: Calculate Julian Date
JD = 2460324.0 (for 2024-01-15 12:00:00 UTC)
Step 2: Calculate days since J2000.0
d = JD - 2451545.0 = 8779.0 days
Step 3: Calculate GMST
θ = 280.46061837 + 360.98564736629 × 8779.0
θ = 280.46 + 3,169,212.96°
θ = 280.46 + 3,169,212.96° mod 360°
θ ≈ 333.42° = 5.819 radians
Step 4: Apply rotation matrix
cos(θ) = -0.896
sin(θ) = -0.444
X_ecef = cos(θ)×X_eci + sin(θ)×Y_eci
= (-0.896)×(-4453.783) + (-0.444)×(5038.203)
= 3991.79 - 2236.96
= 1754.83 km
Y_ecef = -sin(θ)×X_eci + cos(θ)×Y_eci
= (0.444)×(-4453.783) + (-0.896)×(5038.203)
= -1977.48 - 4514.23
= -6491.71 km
Z_ecef = Z_eci = -2878.965 km
Result:
ECEF Position:
X_ecef = 1754.83 km
Y_ecef = -6491.71 km
Z_ecef = -2878.965 km
Code Implementation
JavaScript
function eciToEcef(eci, gmst) {
// gmst in radians
const cosGmst = Math.cos(gmst);
const sinGmst = Math.sin(gmst);
return {
x: cosGmst * eci.x + sinGmst * eci.y,
y: -sinGmst * eci.x + cosGmst * eci.y,
z: eci.z
};
}
function ecefToEci(ecef, gmst) {
const cosGmst = Math.cos(gmst);
const sinGmst = Math.sin(gmst);
return {
x: cosGmst * ecef.x - sinGmst * ecef.y,
y: sinGmst * ecef.x + cosGmst * ecef.y,
z: ecef.z
};
}
function calculateGmst(date) {
// Julian date
const jd = date.getTime() / 86400000 + 2440587.5;
// Days since J2000.0
const d = jd - 2451545.0;
// GMST in degrees
let gmst = 280.46061837 + 360.98564736629 * d;
// Normalize to 0-360
gmst = ((gmst % 360) + 360) % 360;
// Convert to radians
return gmst * Math.PI / 180;
}
Python
import numpy as np
from datetime import datetime
def calculate_gmst(dt):
"""Calculate GMST in radians for a given datetime (UTC)."""
# Julian date
jd = dt.timestamp() / 86400 + 2440587.5
# Days since J2000.0
d = jd - 2451545.0
# GMST in degrees
gmst = 280.46061837 + 360.98564736629 * d
# Normalize and convert to radians
gmst = gmst % 360
return np.radians(gmst)
def eci_to_ecef(eci, gmst):
"""Convert ECI to ECEF coordinates."""
rotation = np.array([
[np.cos(gmst), np.sin(gmst), 0],
[-np.sin(gmst), np.cos(gmst), 0],
[0, 0, 1]
])
return rotation @ eci
def ecef_to_eci(ecef, gmst):
"""Convert ECEF to ECI coordinates."""
rotation = np.array([
[np.cos(gmst), -np.sin(gmst), 0],
[np.sin(gmst), np.cos(gmst), 0],
[0, 0, 1]
])
return rotation @ ecef
# Example usage
dt = datetime(2024, 1, 15, 12, 0, 0)
gmst = calculate_gmst(dt)
eci_pos = np.array([-4453.783, 5038.203, -2878.965])
ecef_pos = eci_to_ecef(eci_pos, gmst)
print(f"ECEF: {ecef_pos}")
Higher Precision Considerations
The simple GMST rotation shown above is accurate to about 1 arcsecond. For higher precision applications, consider:
Precession and Nutation
Earth’s rotation axis slowly wobbles. To convert between GCRF (precise ECI) and ITRF (precise ECEF), you need:
ITRF = W × R × N × P × GCRF
Where:
P = Precession matrix
N = Nutation matrix
R = Earth rotation (sidereal time)
W = Polar motion matrix
Polar Motion
Earth’s rotation axis doesn’t pass exactly through the geographic poles—it wobbles slightly. Polar motion parameters (xp, yp) are published by the IERS.
UT1-UTC Corrections
UTC occasionally has leap seconds added. UT1 is a time scale tied to Earth’s actual rotation. The difference (UT1-UTC) affects precise GMST calculations.
Which Precision Do You Need?
| Application | Required Precision | Method |
|---|---|---|
| General satellite tracking | ~1 km | Simple GMST rotation |
| GPS applications | ~1-10 m | Include polar motion |
| Precise orbit determination | ~cm | Full IAU transformations |
| VLBI, geodesy | ~mm | Complete IERS conventions |
Common Pitfalls
1. Time System Confusion
GMST depends on time. Make sure you’re using:
- UTC for general applications
- UT1 for precise work
- TT (Terrestrial Time) for some astronomical calculations
2. Angle Units
Rotation matrices require angles in radians, but GMST is often calculated in degrees. Always convert before applying the rotation.
3. Sign Convention
The direction of rotation matters:
- ECI to ECEF: Rotate by +θ (or use the matrix shown above)
- ECEF to ECI: Rotate by -θ (transpose of the above matrix)
Getting the sign wrong will put your satellite on the opposite side of Earth!
4. Velocity Transformation
Position-only rotation works for static conversions. For dynamics, you must include the ω×r term for velocity.
5. Frame Variants
Different ECI frames (TEME, J2000, GCRF) require slightly different transformations. Know which frame your source data uses.
Using Our Tools
Our Reference Frame Converter handles ECI ↔ ECEF conversions automatically:
- Enter coordinates in ECI or ECEF
- Specify the date and time
- Get converted coordinates instantly
The tool handles GMST calculation and applies the proper rotation matrix.
Summary
| Aspect | ECI → ECEF | ECEF → ECI |
|---|---|---|
| Operation | Rotate by +GMST | Rotate by -GMST |
| Matrix | R(θ) | R(θ)ᵀ = R(-θ) |
| Z-component | Unchanged | Unchanged |
| Time-dependent | Yes (Earth rotates) | Yes |
Key takeaways:
- ECI and ECEF differ by Earth’s rotation angle (GMST)
- Conversion is a simple rotation about the Z-axis
- The angle depends on time—Earth rotates ~360° per sidereal day
- For velocity, include the ω×r rotational term
- Higher precision requires precession, nutation, and polar motion corrections
- Always verify your time system and angle units
Understanding this conversion bridges the gap between orbital mechanics (computed in ECI) and real-world applications like ground stations and GPS receivers (which use ECEF).