mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +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]>
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
/**
|
|
* @file Load a JSON file shipped beside the source modules.
|
|
*
|
|
* The browser fetches the file from `url` — a `new URL('./….json',
|
|
* import.meta.url)` written in the calling module, which Vite serves as-is in
|
|
* dev and emits as an asset in the production build. Under Node (node:test)
|
|
* that URL is a `file:` URL, which `fetch` cannot read, so the caller's
|
|
* JSON-attributed import runs instead.
|
|
*
|
|
* The attributed import cannot serve the browser: the Vite dev server answers
|
|
* it with a JavaScript module, which the browser rejects for a JSON import.
|
|
*
|
|
* @module data/bundledJson
|
|
*/
|
|
|
|
/**
|
|
* @param {URL} url - Resolved against the calling module's `import.meta.url`.
|
|
* @param {() => Promise<{default: any}>} importJson - The caller's literal
|
|
* `import('./….json', { with: { type: 'json' } })`, used only under Node.
|
|
* @returns {Promise<any>} The parsed JSON.
|
|
*/
|
|
export async function loadBundledJson(url, importJson, { signal } = {}) {
|
|
if (url.protocol === 'file:') return (await importJson()).default;
|
|
signal?.throwIfAborted();
|
|
const response = await fetch(url, { signal });
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP ${response.status} for ${url.pathname}`);
|
|
}
|
|
return response.json();
|
|
}
|