fix(osm): stop using public Overpass by default (#648) (#742)

Traffic roads come from OpenFreeMap vector tiles, or TomTom flow tiles with a
key (Hybrid by default). Military areas use OpenFreeMap polygons with a bundled
worldwide name index; wide views show named points. ALPR reads an hourly
OpenStreetMap extract. Cockpit place context and country, state and US county
outlines use bundled Natural Earth and US Census data. Overpass is used only
when an operator configures their own endpoint.

Also: camera arrivals no longer land below ground, keyless terrain retries on
429, bounded relation geometry for configured Overpass, one shared
OpenStreetMap credit, and separate tile and API transports for embedders.

Co-authored-by: theGaryLarson <[email protected]>
Co-authored-by: Milan Khanal <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-09-28 19:07:57 -05:00
1 parent 81eb44340d
commit f4fcf267c6
200 files changed
+26665 -1977

No files matched your search

+11 -39
View File
@@ -1,36 +1,11 @@
import * as Cesium from 'cesium';
/**
* @file Street Traffic — animated dots along OSM road polylines, colored by
* live TomTom congestion when a key is configured.
*
* Road geometry: OSM Overpass API (free, no auth). Fetches road polylines for
* the camera viewport, spawns PointPrimitives that lerp along pre-computed
* Cartesian3 waypoints. Camera-gated: only active below ~8 km altitude.
*
* Two modes (decided once per session via `/api/tomtom/status`):
* - `sim` (keyless default): white dots at hardcoded per-road-class speeds —
* the original simulation, byte-identical behavior.
* - `live`: TomTom flow tiles (`flowTiles.js`) are matched onto the same
* Overpass roads (`flowMatch.js`); matched roads color/slow/densify their
* dots by real congestion (`trafficFlowStyle.js`), closed roads spawn no
* dots, and unmatched roads keep the simulated white.
*
* Architecture overview:
* - Camera-change listener triggers debounced road fetching per viewport tile.
* - Fetch bounds center on the camera's look-at point (`trafficBounds.js`, C4).
* - Roads are fetched in two passes: major-only (fast) then full graph (detailed).
* - Fetched tiles are cached by clamped bounding-box key to avoid re-fetching.
* - Dot budget allocation distributes a hard cap fairly across visible roads.
* - Each dot lerps along pre-computed Cartesian3 waypoints every preRender frame.
*
* @module data/traffic
* @file Street Traffic selects TomTom, OpenMapTiles or Hybrid motor roads,
* with directional TomTom congestion in live mode. Tile acquisition is
* bounded and camera-driven; animation lerps precomputed Cartesian waypoints.
*/
/** @const {string} Proxy endpoint for Overpass API queries */
export const OVERPASS_URL = '/api/overpass';
/** @const {number} Meters — hide all traffic dots above this camera altitude */
export const ACTIVATION_ALTITUDE = 8000;
@@ -55,6 +30,14 @@ export const OVERLAP_THRESHOLD = 0.6;
export const MAX_DOTS = 6000;
/** Keep a dense street view while bounding both dot and surface work at city scale. */
export function roadDotBudget(altitude) {
return Math.max(
400,
Math.round(MAX_DOTS * Math.pow(1000 / Math.max(1000, altitude), 2)),
);
}
/** @const {number} Polylines longer than this are simplified by sub-sampling */
export const MAX_WAYPOINTS_PER_ROAD = 80;
@@ -164,17 +147,6 @@ export const HEAT_JAM_COLOR = Cesium.Color.fromCssColorString('#e05252');
export const HEAT_SLOW_COLOR =
Cesium.Color.fromCssColorString('#f0b23e').withAlpha(0.2);
/**
* @const {number} Meters — jam dots depth-test-punch through the 3D tiles out
* to this camera distance so queues stay visible at city scale. The single
* start-of-road terrain sample puts much of a road below the rendered mesh
* at oblique city views (first A/B capture: 396 jam dots, zero visible), so
* the shipped 2 km window hides exactly the congestion this prototype is
* meant to surface. Live jam dots only; sim dots keep the shipped 2 km.
*/
export const JAM_DOT_DEPTH_PUNCH = 15000;
/** @const {number} Far-distance scale floor for jam dots (shipped: 0.3). */
export const JAM_DOT_FAR_SCALE = 0.55;