mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
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:
200 files changed
+26665
-1977
No files matched your search
@@ -8,7 +8,7 @@ import { VectorTile } from '@mapbox/vector-tile';
|
||||
* (the TomTom key never reaches the browser) and decodes the Mapbox Vector
|
||||
* Tile layer "Traffic flow" into plain lon/lat polylines with congestion
|
||||
* attributes. Consumed by the traffic layer's live mode
|
||||
* (`src/data/traffic.js` → `src/data/flowMatch.js`).
|
||||
* for matching congestion onto OpenStreetMap roads.
|
||||
*
|
||||
* Segment shape: `{coords: [[lon,lat],…], trafficLevel: 0..1, roadType: string,
|
||||
* closure: boolean}` — `trafficLevel` is TomTom's current/free-flow speed
|
||||
@@ -23,13 +23,15 @@ import { VectorTile } from '@mapbox/vector-tile';
|
||||
*/
|
||||
|
||||
const FLOW_LAYER_NAME = 'Traffic flow';
|
||||
export function decodeFlowTile(data, z, x, y) {
|
||||
/** Decode flow geometry; strict mode distinguishes damaged tiles from valid empty coverage. */
|
||||
export function decodeFlowTile(data, z, x, y, { strict = false } = {}) {
|
||||
let layer;
|
||||
try {
|
||||
const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
||||
const tile = new VectorTile(new PbfReader(bytes));
|
||||
layer = tile.layers[FLOW_LAYER_NAME];
|
||||
} catch {
|
||||
if (strict) throw new Error('Malformed TomTom flow tile');
|
||||
return [];
|
||||
}
|
||||
if (!layer) return [];
|
||||
@@ -63,7 +65,18 @@ export function decodeFlowTile(data, z, x, y) {
|
||||
: [];
|
||||
for (const coords of lines) {
|
||||
if (!Array.isArray(coords) || coords.length < 2) continue;
|
||||
segments.push({ coords, trafficLevel, roadType, closure });
|
||||
segments.push({
|
||||
coords,
|
||||
trafficLevel,
|
||||
roadType,
|
||||
roadCategory: props.road_category ?? null,
|
||||
roadSubcategory: props.road_subcategory ?? null,
|
||||
closure,
|
||||
coverage: props.traffic_road_coverage ?? null,
|
||||
leftHandTraffic:
|
||||
props.left_hand_traffic === true ||
|
||||
props.left_hand_traffic === 'true',
|
||||
});
|
||||
}
|
||||
}
|
||||
return segments;
|
||||
|
||||
Reference in new issue
Block a user