Satellite Tracking, Explained: TLEs, SGP4, and Why That Dot Is a Prediction
Flight trackers listen to aircraft broadcasting their own GPS positions. Satellite trackers can't do that — almost nothing in orbit is telling your website where it is. When you watch the ISS glide across a tracking map,
Flight trackers listen to aircraft broadcasting their own GPS positions. Satellite trackers can't do that — almost nothing in orbit is telling your website where it is. When you watch the ISS glide across a tracking map, you're watching a mathematical prediction, computed on the fly from a 2-line text file that may be a day old.
Surprisingly, that prediction is usually accurate to within a kilometre or so. Here's the whole system — where the data comes from, what the model does, and how to put live satellites on a globe yourself. This is the same pipeline behind the satellite layer on WorldEye, where satellites share the globe with live flights, cameras and weather.
The Two-Line Element: 1960s format, still running the world
Orbital data is published as TLEs (Two-Line Element sets), a fixed-width text format designed for punch cards. Here's the ISS, more or less:
ISS (ZARYA)
1 25544U 98067A 24320.50000000 .00016717 00000-0 10270-3 0 9000
2 25544 51.6400 208.9163 0006703 69.9862 25.2906 15.49560532 10
Every column means something. The greatest hits:
- 25544 — the catalogue number. The ISS is object 25544 in the public catalogue maintained from US Space Force tracking (distributed via CelesTrak and others). Starlink trains, weather satellites, debris — everything tracked has one.
- 51.6400 — inclination: the orbit is tilted 51.64° to the equator, which is why the ISS ground track weaves between roughly ±51.6° latitude and never flies over the poles.
- 15.4956… — mean motion, in revolutions per day. ~15.5 orbits/day ⇒ a period of about 93 minutes ⇒ one sunrise every hour and a half for the crew.
-
The epoch (year + day-of-year
24320.5…) — the moment this element set describes. A TLE is only "true" at its epoch. Everything else is extrapolation. - Line 1 also smuggles in drag terms (
B*and the mean-motion derivative) — the atmosphere's fingerprint on the orbit.
There is no latitude/longitude anywhere in this file. A TLE describes an orbit, not a position.
SGP4: turning an orbit into a position, right now
To get a dot on a map you run the TLE through SGP4 (Simplified General Perturbations 4), the standard propagator published alongside the format. Feed it a TLE + a timestamp, get back position and velocity in Earth-centred coordinates (ECI, in km), then rotate into Earth-fixed latitude/longitude/altitude using the Earth's rotation at that instant.
Why a special model instead of plain Kepler? Because low Earth orbit is messy: the Earth is oblate (its equatorial bulge tugs orbits around), the upper atmosphere drags on everything, and the Moon and Sun add their own pulls. SGP4 bakes in the dominant corrections, which is what keeps the error at ~1 km at epoch instead of ~100 km by the weekend.
In JavaScript this is a solved problem — the satellite.js library is a faithful SGP4 port:
import * as satellite from "satellite.js";
const tleLine1 = "1 25544U 98067A 24320.50000000 .00016717 00000-0 10270-3 0 9000";
const tleLine2 = "2 25544 51.6400 208.9163 0006703 69.9862 25.2906 15.49560532 10";
const satrec = satellite.twoline2satrec(tleLine1, tleLine2);
// Propagate to "now" (or any Date)
const posVel = satellite.propagate(satrec, new Date());
const gmst = satellite.gstime(new Date());
// ECI (km) -> geodetic lat/lon/alt
const geo = satellite.eciToGeodetic(posVel.position, gmst);
const lat = satellite.degreesLat(geo.latitude);
const lon = satellite.degreesLong(geo.longitude);
const altKm = geo.height;
console.log(lat, lon, altKm); // ~ ISS, right now, within about a kilometre
That's genuinely the whole core loop. Everything else is engineering around it.
The engineering around it
Refresh your TLEs, and watch the epoch. Accuracy decays with age — slowly for the ISS (a fresh TLE every day or so keeps you honest), fast for manoeuvring satellites and decaying debris. Starlink satellites raise their orbits after launch, so a launch-week TLE goes stale in hours. A production tracker fetches fresh element sets on a schedule and drops or flags objects whose epochs are ancient.
Propagate on the client, ship only TLEs. This is the architectural gift of the whole system: instead of streaming positions for 8,000+ tracked objects from your server, you send the browser a compact catalogue of TLEs (a few hundred bytes each) and let each client run SGP4 locally at render rate. The server's job shrinks to "fetch, validate and cache a text file a few times a day." Compare that with the flight layer, where positions really do stream.
Sample the orbit for the path, don't just draw the dot. The pretty ground-track line is just propagation repeated: sample ±45 minutes at 30-second steps, convert each point, draw the polyline — with a seam where it crosses the antimeridian, which will bite you exactly once before you learn to split the line there.
Know what the model can't tell you. SGP4 gives you where an object should be. It won't tell you a satellite has died, tumbled, or manoeuvred since its epoch. Re-entries and breakups are where trackers and reality part ways — which is why serious space-surveillance is a sensor network, not a text file. For a public map, the honest label is "predicted position from elements dated X."
Planes vs satellites: the tell
A side benefit of understanding both systems: you'll never confuse them in the night sky again. An aircraft at 10 km moving at 250 m/s crosses your view slowly, blinks in patterns, and — on a tracker — is measured. A satellite at 420 km moving at 7.66 km/s is a steady, silent point of light on a 93-minute heartbeat, and on a tracker it's computed. Same map, two completely different epistemologies.
Go look
Open the satellite layer on worldeye.app, find the ISS, and watch its ground track: that sine-wave path is the 51.64° inclination from the TLE, drawn live. Then propagate it yourself with the snippet above and compare — getting the same answer from 20 lines of code is the best proof that this 1960s format still runs the world.
Building something with TLEs? Ask in the comments — the antimeridian seam, epoch staleness and catalogue filtering (which of the ~30k tracked objects are worth drawing?) are all worth a follow-up post if there's interest.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.