Step 1: How GPS Satellites Power an Online Speedometer
The Global Positioning System (GPS) is a constellation of 31 active satellites orbiting Earth at approximately 20,200 km altitude. Each satellite continuously broadcasts a precise timestamp and its orbital position. Your phone's GPS chip receives signals from four or more satellites simultaneously.
By measuring the tiny time difference between when each signal was broadcast and when it was received, the chip calculates its distance from each satellite. With four distances known, it can pinpoint your exact position in 3D space: latitude, longitude, and altitude. This is the same satellite data this online speedometer reads to show your live GPS speed.
Step 2: Calculating Speed
GPS chips use two methods to calculate speed:
Doppler shift method (primary): Just like a police radar gun, GPS receivers detect the Doppler shift in satellite signal frequency caused by your motion. This gives a near-instantaneous speed reading that is highly accurate: typically within 0.1 m/s.
Position differencing (fallback): When the Doppler method isn't available, speed is derived by dividing the distance between two consecutive position fixes by the elapsed time. Zpeedometer uses the Haversine formula to compute this distance accurately across the curved surface of the Earth.
Step 3: The Web Geolocation API
Zpeedometer uses the W3C Web Geolocation API: a standard built into every modern browser. When you tap Start GPS, the browser asks for your permission to access location data.
Once granted, the API returns a GeolocationPosition object every 1–2 seconds containing:
coords.latitude&coords.longitude: your positioncoords.speed: speed in m/s (null if unavailable)coords.accuracy: estimated position accuracy in metrestimestamp: Unix timestamp of the fix
Zpeedometer reads coords.speed first. If it's null, zero, or negative (which some devices return erroneously), it falls back to the Haversine calculation from position deltas.
Step 4: The Haversine Formula
The Haversine formula calculates the shortest distance between two points on a sphere given their latitudes and longitudes:
a = sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlon/2)
c = 2 × atan2(√a, √(1−a))
d = R × c (R = 6,371,000 m)
Dividing d (in metres) by the time elapsed (in seconds) gives speed in m/s, which is then converted to your chosen unit.
Step 5: Rendering the Gauge
The speedometer dial is drawn on an HTML5 <canvas> element using the 2D Canvas API. Each animation frame (via requestAnimationFrame) the gauge is redrawn with:
- A dark circular face with tick marks at every 10 km/h
- A colour-graduated arc from blue (slow) through orange to red (fast)
- A smooth animated needle pointing to the current speed
- DPR (device pixel ratio) scaling for crisp rendering on retina displays
Privacy Architecture
All of the above happens entirely within your browser tab. No position data, speed data, or any other information is transmitted to Zpeedometer's servers or any third party. The site has no cookies, no analytics, and no user accounts. Your location is yours alone.