A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.
JavaScript 3d-globecesiumflight-trackinggeospatialgeospatial-intelligencegisosintphotogrammetrysatellite-trackingspatial-intelligencewebglworldview
fix: resolve bundled data URLs when used, not at import
Sameh Khamisf752b5eea1a5
diff --git a/src/data/infrastructure.js b/src/data/infrastructure.jsindex ea78494c8..348d4bfb4 100644--- a/src/data/infrastructure.js+++ b/src/data/infrastructure.js@@ -1,15 +1,14 @@import { createLocalGeoJsonLayer } from './localGeojsonCore.js';import { INFRASTRUCTURE_DATA_URLS } from '../sources/infrastructureData.js';-const datacentersUrl = INFRASTRUCTURE_DATA_URLS['local-datacenters'];-const damsUrl = INFRASTRUCTURE_DATA_URLS['local-dams'];-/*** Create fresh datacenter and dam layers without starting or loading them.* @param {object} services Caller-owned context, overlay and render operations.* @returns {object[]} Datacenters then dams, with stable standalone identities.*/export function createInfrastructureLayers(services) {+ const datacentersUrl = INFRASTRUCTURE_DATA_URLS['local-datacenters'];+ const damsUrl = INFRASTRUCTURE_DATA_URLS['local-dams'];const datacenters = createLocalGeoJsonLayer({id: 'local-datacenters',diff --git a/src/layers/submarineCables/bundledSource.js b/src/layers/submarineCables/bundledSource.jsindex 6aa0b70bb..881522ee9 100644--- a/src/layers/submarineCables/bundledSource.js+++ b/src/layers/submarineCables/bundledSource.js@@ -1,14 +1,19 @@// This dataset is CC BY-NC-SA 3.0, not the project's MIT license.// Commercial users must remove it or obtain a TeleGeography license.// See DATA_SOURCES.md and the bundled dataset's source.json.-const cableUrl = new URL(- '../../data/local_data/telegeography_submarine_cables/cable-geo.json',- import.meta.url,-).href;-const landingPointUrl = new URL(- '../../data/local_data/telegeography_submarine_cables/landing-point-geo.json',- import.meta.url,-).href;+// Resolved when read, so importing this module never needs a module URL.+function cableUrl() {+ return new URL(+ '../../data/local_data/telegeography_submarine_cables/cable-geo.json',+ import.meta.url,+ ).href;+}+function landingPointUrl() {+ return new URL(+ '../../data/local_data/telegeography_submarine_cables/landing-point-geo.json',+ import.meta.url,+ ).href;+}/** Supply GeoJSON collections without coupling the renderer to asset URLs. */export function createBundledCableSource({@@ -33,8 +38,8 @@ export function createBundledCableSource({label: 'TeleGeography',async fetch(signal) {const [cables, landingPoints] = await Promise.all([- read(cableUrl, signal),- read(landingPointUrl, signal),+ read(cableUrl(), signal),+ read(landingPointUrl(), signal),]);return { cables, landingPoints };},diff --git a/src/sources/infrastructureData.js b/src/sources/infrastructureData.jsindex 6936b9aa5..33206ab44 100644--- a/src/sources/infrastructureData.js+++ b/src/sources/infrastructureData.js@@ -3,16 +3,19 @@* data files, line-delimited GeoJSON parsing and analyst records.*/-// Resolved by Vite in builds and relative to this module in other consumers.+// Resolved by Vite in builds and relative to this module in other consumers,+// when read, so importing this module never needs a module URL.export const INFRASTRUCTURE_DATA_URLS = Object.freeze({- 'local-datacenters': new URL(- '../data/local_data/datacenters/datacenters.geojsonl',- import.meta.url,- ).href,- 'local-dams': new URL(- '../data/local_data/dams/dams.geojsonl',- import.meta.url,- ).href,+ get 'local-datacenters'() {+ return new URL(+ '../data/local_data/datacenters/datacenters.geojsonl',+ import.meta.url,+ ).href;+ },+ get 'local-dams'() {+ return new URL('../data/local_data/dams/dams.geojsonl', import.meta.url)+ .href;+ },});/** Parse GeoJSON Lines: one Feature per non-empty line. */