Added uncertainty circle and zipping

This commit is contained in:
beans
2026-10-28 13:43:27 -05:00
parent 5f5be1b8d3
commit 499dc3bd54
10 changed files with 218 additions and 16 deletions
+3 -1
View File
@@ -20,7 +20,9 @@ Open `http://YOUR_VPS_HOST:8080`. Allow the car to reach TCP port 2948 and the b
The browser polls every two seconds. Speed comes from gpsd in metres per second and is shown in mph and km/h. The current gpsd dependency represents omitted speed as zero, so a GPS report without speed can appear stationary. Reports without a position fix are ignored. “Last update” uses the GPS fix time, falling back to server receipt time when absent. After 30 seconds, the page marks the fix stale and hides current speed. Delayed timestamped fixes cannot replace newer fixes.
The server retains only the latest fix in memory; a restart clears it. There is no route history or durable client queue. The existing gob-wrapped JSON wire format is retained; both binaries should be rebuilt for speed support. Browser access to unpkg.com and tile.openstreetmap.org is required for the map. Map integration follows the [Leaflet quick start](https://leafletjs.com/examples/quick-start/); OpenStreetMap attribution is included.
The map shades an estimated GPS uncertainty circle around each fix. Its radius is `hypot(LatErr, LongErr)` in metres, enclosing the reported north–south and east–west error ranges. The circle moves and resizes with each fix and is hidden when either estimate is missing, zero, negative, or non-finite. A stale fix retains its last reported circle; it does not predict movement since the fix. This is an estimate, not a guaranteed confidence boundary: [gpsd notes that error confidence varies by receiver](https://gpsd.io/gpsd_json.html).
The server retains only the latest fix in memory; a restart clears it. There is no route history or durable client queue. The client compresses each JSON batch into an in-memory ZIP containing `points.json`, then sends the ZIP bytes inside the existing gob framing. The server unzips in memory, validates the archive and checksum, and accepts at most 4 MiB compressed and 16 MiB expanded. No temporary files are created. Upgrade the server first: it also accepts legacy uncompressed JSON batches. Then rebuild and restart the client to enable compression. Browser access to unpkg.com and tile.openstreetmap.org is required for the map. Map integration follows the [Leaflet quick start](https://leafletjs.com/examples/quick-start/); OpenStreetMap attribution is included.
Checks: