# ROP traffic product v0.1.0: Lynn Shore Drive at Nahant Circle (lane rop:ansel)

Written 2026-10-25 by Claude Code (Ansel `01a16f0a`, lane `rop:ansel`) for BOS-Takeoff-Veillance `8ac6d87f`, first product of the ROP bead `01a173e5` (orientation note `2026-10-25/notes/rop-orientation_q4w8n2zt.md`). For the 2026-10-31 internal tech demo to Yossi Matias. All new files; no existing file edited.

## Product (live, public)

- Viewer: https://stephenguerin.live/agents/8ac6d87f-3192-4fdb-a260-583dbee74291/artifacts/rop/lynn-shore-nahant-circle/index.html (three.js WebGL2: tiles draped on surface.glb in 3D; 2D ortho mode; time slider; cadence frame / 1 s; Google-base toggle)
- STAC Collection: https://stephenguerin.live/agents/8ac6d87f-3192-4fdb-a260-583dbee74291/artifacts/rop/lynn-shore-nahant-circle/collection.json (440 PT0.033S Items + 16 PT1S Items under `items/`)
- Stack MP4 (H.264, 3320x672, 30 fps, 22 MB): https://stephenguerin.live/agents/8ac6d87f-3192-4fdb-a260-583dbee74291/artifacts/rop/lynn-shore-nahant-circle/stack_PT0.033S.mp4
- Verification page: https://stephenguerin.live/agents/8ac6d87f-3192-4fdb-a260-583dbee74291/artifacts/rop/lynn-shore-nahant-circle/verify/
- Code: `artifacts/rop/tools/` (`score-aoi.mjs`, `aoi.mjs`, `surface.mjs`, `glb.mjs`, `render.mjs`, `lock.mjs`, `cog.mjs`, `stac.mjs`, `verify.mjs`, `verify-page.mjs`, `anaglyph.mjs`, `rop-lib.mjs`). Node + sharp (plume-recon's node_modules) + ffmpeg; no Python.

## AOI and why

`lynn-shore-nahant-circle`: Nahant Circle and 750 m of Lynn Shore Drive north-east of it, a rotated rectangle 830 x 168 m along the drive (bearing 46.07 deg), clip 115634 f136 to f575 (15:56:39.86 to 15:56:54.53 UTC, coverage >= 50%; 249 frames >= 90%).

`score-aoi.mjs` scored every OSM motorway/trunk/primary 500 m window over clips 115531 and 115634 (frames fully in view x (0.3 m / GSD)^2; `aoi-candidates.json`). Route 1A at Butler Circle / North Shore Rd, Revere (115531 f360 to f710, GSD 0.23 m) scored highest. Lynn Shore Drive came second (330 consecutive frames, GSD 0.32 m), and it is in the Ocean House Surf YouTube cam (KziwCV7db9s, DVR 15:53:25 to 15:59:30Z, looking north across Nahant Bay). That makes it the multi-camera fusion candidate, which Stephen's preference (relayed by the coordinator) ranks first. No MassDOT camera sees either candidate. The only mass511 camera in the footprint, 13552 (US 1 Revere at Squire Rd), would give about 0.7 m GSD at 10 deg elevation. The Collection's `rop:related_cameras` records these cameras and their time coverage.

## Method

1. **Surface** (`surface.mjs`): Google Photorealistic 3D Tiles, 401 finest leaves (geometric error 2.0 m), 313k triangles. Vertical rays at 0.5 m over the grid plus a 50 m margin go to the BVH, giving the DSM and a true-ortho base layer from the tile texture. `glb.mjs` writes `surface.glb`: a 1 m vertex mesh (140k vertices) with UV = the ortho grid (u = column/W, v = row/H), so any tile drapes as its texture. Its default texture is the Google true-ortho. Heights are EGM96 (geoid -28.6).
2. **Height frame (finding):** calib8k rendered its tile anchors through image-geo-projection's `NORTE_GEOID` (-35.5 m), not Boston's -28.6. The poses therefore live in a frame where the eye sits 6.9 m low relative to the tiles. I project in that same frame (DSM h = hEll + 35.5) for consistency. The 6.9 m is recorded in `surface/dsm.json`.
3. **Per frame** (`render.mjs`, view-dependent): ffmpeg decodes the exact 8K frame (seek = pose t_s - 1 ms) in 30-frame chunks and crops each chunk to the union of its frames' AOI windows (about 3500 x 1500 of 7680 x 4320). The full frame is never emitted. Each 0.25 m cell is a DSM point, projected through the pose with camera.mjs and sampled bilinearly. Occlusion is a ray-march over the DSM toward the eye (1.0 m tolerance), median 6.8% occluded. The cabin window uses calib8k `windowMask` on the 960 proxy, seeked by frame INDEX through `takeoff-player/data/proxy-pts.json`.
4. **Lock** (`lock.mjs`): each tile gets a ground affine plus gain/bias, fitted by robust Gauss-Newton (Tukey weights; 1 m then 0.5 m) against the temporal median of the registered stack. It runs 3 rounds on 12 worker threads (104 s). The static mask is MAD < 6 and gradient > 2. Then an **absolute** step registers the median to the Google true-ortho and composes that into every A. pass2 re-renders through A, so the 8K pixels are resampled only once.
5. **Assets** (`cog.mjs`, `stac.mjs`): each tile is a COG written in plain JS: RGB JPEG (YCbCr 4:2:0) in 256 px tiles, 4 overviews, ModelTransformation for the rotated grid, EPSG:32619, NoData 0. GDAL `validate_cloud_optimized_geotiff.py` reports it valid, and `gdalinfo /vsicurl/` reads it over the public URL (HTTP 206 ranges). Each tile also has an 830 px thumbnail. PT1S tiles have full-resolution JPEG visuals. Items carry start/end_datetime (the frame interval), proj (EPSG:32619 + transform), view (off-nadir ~50 deg, azimuth ~170 deg), source clip/frame/frame-service URL, the pose row and sigma, the lock correction and residual, GSD, occlusion and coverage. The Collection carries the datacube dims x, y, z, time, providers, license "other" (internal demo, linked), and related_cameras.

## Verified (numbers from `lock/stability.json`, 112 static 12 m blocks, against the product's temporal median, in 0.25 m output px)

| | with lock | without lock |
|---|---|---|
| median block displacement | **1.05 px (0.26 m)** | 38.3 px (9.6 m) |
| blocks within 3 m | 85% | 0.8% |
| RMS of those inliers | 2.2 px | 9.1 px |
| per-frame mean shift, RMS | 4.2 px (1.05 m) | 40.4 px (10.1 m) |
| block frame-to-frame p50 / p90 | 0.13 / 0.81 px | 0.74 / 8.3 px |
| p95 of all matches | 56 px | 89 px |

The heavy tail (p95) comes from false matches and real residuals on roofs and walls: building lean against a mesh with 2 m geometric error, plus occlusion edges. On the ground, the drift tail is in the partial-coverage frames at both ends of the window (f136 to f165, f480 to f575), where few static blocks remain.

- **Raw projection drift (finding):** before the lock, static ground drifts smoothly from -16 m to +13 m along the road over 14 s. The sign flips as the AOI crosses the image centre along the bottom edge. This matches the unmodelled lens distortion at the frame's bottom edge (the fixed-view lane measured about 55 px at 8K). The absolute step found a scale of 0.984 along the road. The pose summary's held-out `dhfov_rel` (-0.8% to -1.6%) points the same way: an hfov / distortion bias. A one-parameter radial term in calib8k would remove most of the lock's work.
- **Absolute:** the stack median sat 11.4 m along-road and 1.5 m across from the Google true-ortho. After the absolute step, crosswalks and curbs coincide (`verify/absolute_anaglyph_*`).
- **Looked at:** MP4 frames decoded back (`verify/mp4_*`). Full-resolution crops 0.5 s apart (`verify/crops_*`): paint and curbs fixed, vehicles moving. A change map against the median (`verify/change_vs_median_f356.png`): vehicles along the lanes, surf and building edges light up, static ground does not. Time streaks (`verify/streak_*`): locked static features are straight lines, unlocked ones slant, and vehicle tracks are diagonals within the lanes.
- **Viewer:** loaded in Chrome over CDP (`t3d-cdp.mjs`, port 9343) with 440 frames and 16 PT1S items. Screenshots: `verify/viewer_3d_frame.png`, `viewer_2d_frame.png`, `viewer_3d_PT1S.png`, `viewer_3d_playing.png`. Playback advanced 90 frames in 3 s.

## Known limits

- GSD is 0.34 to 0.43 m effective (0.27 m cross, 0.43 m along range, off-nadir ~50 deg) on a 0.25 m grid, so cars are about 10 x 5 px. Traffic on Lynn Shore Drive is light, with many parked cars along it.
- Building walls and roofs smear and lean against the 3D Tiles mesh. North sides are black where they are occluded (as the method says).
- Lock residuals are larger in the partial-coverage end frames, where few static blocks remain; Items flag these by `rop:coverage`.
- The Google content (DSM, base texture in surface.glb and surface/base_0p5m.jpg) is for the internal demo only (ROP bead section 11).
- The COG has JPEG compression and NoData 0 but no internal mask, so a few genuinely black pixels read as NoData.
- The STAC JSON was not run through a schema validator (none installed). The COGs were GDAL-validated.
- Size: 264 MB of COGs, 18 MB thumbs, 22 MB MP4.

## Next

1. Fuse the Nahant cam: pose KziwCV7db9s once (3D Tiles render-and-compare) plus a clock offset, then project into the same grid. Its GSD on the drive is coarse (grazing, 2 to 3 km), so it adds a second view and time beyond the takeoff, not resolution.
2. A radial distortion term in calib8k, then re-render (the lock gets smaller and the ends improve).
3. A vehicle detector and tracker on the locked stack (the streaks already show the tracks).
4. TaosEngine WebGPU backend for the viewer; lazy time-tiles through the co-hosted job queue.
