fix(cctv): keep missing numbers unknown instead of reading them as zero

Number() reads null, blank strings and booleans as 0 (or 1), and
/api/cctv/sources sends an unknown number as JSON null. A source-pack
camera that left out its pose therefore reached the browser as zeros
clamped to each field's floor (north, pitch -2, FOV 20, range 120 m,
mount 6 m, ground 0 m) instead of taking the defaults, and a null or
blank position put the camera at 0,0.

toFiniteNumber (server) and safeNumber (browser) now return the fallback
for absent, blank and boolean values, as validateBox already does for
Recent Imagery. The same conversion fixes the per-pack paths: a Tallinn
row with a null heading no longer reads as a high-confidence north-facing
camera, a Caltrans camera with a blank elevation keeps its 150 m ground
prior, and TfL or Catalonia cameras with a null or blank coordinate are
dropped instead of kept at 0,0 or on the zero meridian.
This commit is contained in:
omerbberk committed 2026-10-16 00:27:41 +00:00
1 parent a0400b52fb
commit 4399febaa0
6 files changed
+299

No files matched your search

+11
View File
@@ -1314,6 +1314,17 @@ Node-only package entries expose both provider factories. Routes, payloads,
fallback behavior and existing dev/preview hook registration are preserved;
browser rendering is unchanged.
## CCTV missing numeric fields
CCTV numbers are read as missing when they are absent, null, blank or boolean,
on the server (`toFiniteNumber`, every pack and the file/env source packs) and
in the browser (`safeNumber`). `/api/cctv/sources` sends an unknown number as
JSON null; the browser then applies the field's default — id-hash heading,
pitch −17°, FOV 74°, range 700 m, mount 24 m, the city's ground elevation —
rather than reading zero and clamping it to the field's floor. A camera with a
missing latitude or longitude is skipped by the browser catalog instead of
being placed at 0,0. Real zeros, including `"0"`, are kept.
## Terrain, traffic, fire and bike-share provider modules
Local composition now imports separate Node modules for Re:Earth heights,