diff --git a/DATA_SOURCES.md b/DATA_SOURCES.md index 3a2d5f62b4..d121ddff05 100644 --- a/DATA_SOURCES.md +++ b/DATA_SOURCES.md @@ -411,7 +411,7 @@ The [Bhote Koshi event pack](public/events/bhote-koshi-2026/README.md), under `p | Dataset | Folder | License | Commercial use? | Attribution | | --------------------------------------------------------------------------- | --------------------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------- | | **Datacenters** (4,352) | `datacenters/` | **ODbL 1.0** (OpenStreetMap extract) | ✅ (attribution + share-alike on data) | © OpenStreetMap contributors (shared credit) | -| **Dams** (706) | `dams/` | **ODbL 1.0** (OpenInfraMap / OSM extract; Acaray and Yacyretá supplemented from the OSM API) | ✅ (attribution + share-alike on data) | © OpenStreetMap contributors (shared credit) + Open Infrastructure Map | +| **Dams** (706) | `dams/` | **ODbL 1.0** (OpenInfraMap / OSM extract + OSM API) | ✅ (attribution + share-alike on data) | © OpenStreetMap contributors (shared credit) + Open Infrastructure Map | | **Military area names** (36,466) | `osm_military_names/` | **ODbL 1.0** (OpenStreetMap, via Overture Maps) | ✅ (attribution + share-alike on data) | © OpenStreetMap contributors (shared credit) + Overture Maps Foundation | | **Ukraine outline** (Rail layer no-positions rule; 1 ring, 7,801 points) | `src/data/railNoPositions.js` | **ODbL 1.0** (OpenStreetMap, via geoBoundaries gbOpen UKR ADM0, commit 9469f09; simplified to 0.0005°) | ✅ (attribution + share-alike on data) | © OpenStreetMap contributors (shared credit) + geoBoundaries | | **Québec CCTV source catalog** (1,120 locations) | `public/quebec-cameras.json` | Mixed: MTQ locations CC BY 4.0; Montréal camera nodes ODbL 1.0; scenic records retain per-record provenance. No video files are bundled or cached. | Location data is per-record; video remains hosted by Québec 511 and its platform terms apply; scenic source pages may have separate terms | MTQ / Données Québec CC BY 4.0; © OpenStreetMap contributors (ODbL); scenic operator and position source shown in the selected-camera panel | diff --git a/changelog.d/1152-acaray-yacyreta-dams.md b/changelog.d/1152-acaray-yacyreta-dams.md new file mode 100644 index 0000000000..01b99c6c70 --- /dev/null +++ b/changelog.d/1152-acaray-yacyreta-dams.md @@ -0,0 +1,3 @@ +- Add the Acaray and Yacyretá dams from OpenStreetMap to the Dams layer, and + credit the layer to OpenStreetMap / OpenInfraMap instead of USACE (radianx, + #1152). diff --git a/changelog.d/1152-review-update.md b/changelog.d/1152-review-update.md deleted file mode 100644 index f7ec614eac..0000000000 --- a/changelog.d/1152-review-update.md +++ /dev/null @@ -1,3 +0,0 @@ -- Add Acaray and Yacyretá dam geometries from OpenStreetMap to the existing Dams - layer, with source provenance and a corrected OpenStreetMap source label - (radianx, #1152). diff --git a/docs/INFRASTRUCTURE-LAYERS.md b/docs/INFRASTRUCTURE-LAYERS.md index ad8c20b586..bcfece2df4 100644 --- a/docs/INFRASTRUCTURE-LAYERS.md +++ b/docs/INFRASTRUCTURE-LAYERS.md @@ -85,4 +85,4 @@ globals. Dataset files and source/license notices remain under `src/data/local_data/`. Their input counts are 4,352 datacenter features and 706 dam features. A multipart geometry draws as several parts, each with its own stem; part and stem counts are -different measurements from feature counts. This change does not refresh or relicense the datasets. +different measurements from feature counts. diff --git a/src/data/damsParaguayLayer.test.mjs b/src/data/damsParaguayLayer.test.mjs deleted file mode 100644 index 42dd657a58..0000000000 --- a/src/data/damsParaguayLayer.test.mjs +++ /dev/null @@ -1,101 +0,0 @@ -// Regression: both dams added by #1152 must reach the Dams layer itself — -// a stem/label (selection context) and a voice analyst record — not only -// the find_infrastructure query source. -// Place at src/data/damsParaguayLayer.test.mjs and run: -// node --test src/data/damsParaguayLayer.test.mjs -import { test } from 'node:test'; -import assert from 'node:assert/strict'; -import { readFileSync } from 'node:fs'; -import * as Cesium from 'cesium'; -import { localGeoJsonServices } from '../app/localGeojsonServices.js'; -import { createLocalGeoJsonLayer } from './localGeojsonCore.js'; - -const ADDED = new Map([ - [262532166, 'Acaray'], - [-5671745, 'Represa Yacyretá-Apipé'], -]); - -const features = readFileSync( - new URL('./local_data/dams/dams.geojsonl', import.meta.url), - 'utf8', -) - .trim() - .split('\n') - .map((line) => JSON.parse(line)) - .filter((feature) => ADDED.has(feature.id)); - -const quietEvent = () => ({ addEventListener: () => () => {} }); - -test('Acaray and Yacyretá each get a layer stem, selection context and analyst record', async () => { - assert.equal(features.length, 2, 'both added features are bundled'); - const originalFetch = globalThis.fetch; - const originalWindow = globalThis.window; - globalThis.window = { dispatchEvent() {} }; - globalThis.fetch = async () => ({ - ok: true, - status: 200, - text: async () => features.map((f) => JSON.stringify(f)).join('\n'), - }); - const contexts = []; - const overlayHost = { setVisible() {}, setEntries() {}, clearSource() {} }; - const viewer = { - selectedEntity: undefined, - dataSources: { add: (dataSource) => dataSource, remove: () => true }, - camera: { - positionWC: Cesium.Cartesian3.fromDegrees(-55.5, -26.5, 900_000), - frustum: { fov: Math.PI / 3 }, - moveEnd: quietEvent(), - flyTo() {}, - }, - scene: { - canvas: { clientWidth: 800, clientHeight: 600 }, - preRender: quietEvent(), - sampleHeightSupported: false, - sampleHeight: () => undefined, - screenSpaceCameraController: { enableInputs: true }, - pick: () => null, - requestRender() {}, - }, - }; - const layer = createLocalGeoJsonLayer( - { - id: 'local-dams', - url: '/dams.geojsonl', - name: 'Dams', - color: '#0088ff', - projectToWindow: () => ({ x: 400, y: 300 }), - screenSpaceEventHandlerFactory: () => ({ - setInputAction() {}, - destroy() {}, - }), - }, - { - ...localGeoJsonServices, - overlayHost, - registerEntityContext: (entity, context) => contexts.push(context), - }, - ); - try { - await layer.enable(viewer); - assert.equal(layer.getStats().count, 2); - const expected = [...ADDED.values()].sort(); - assert.deepEqual( - contexts.map((context) => context.label).sort(), - expected, - 'each added dam registers a selection context (stem, label, card)', - ); - const rows = layer.getAnalystRecords(); - assert.deepEqual( - rows.map((row) => row.name).sort(), - expected, - 'each added dam is visible to voice analyst_query', - ); - for (const row of rows) - assert.ok(Number.isFinite(row.lat) && Number.isFinite(row.lon)); - } finally { - layer.destroy(viewer); - globalThis.fetch = originalFetch; - if (originalWindow === undefined) delete globalThis.window; - else globalThis.window = originalWindow; - } -}); diff --git a/src/data/infrastructure.test.mjs b/src/data/infrastructure.test.mjs index 1c41da26a1..677bde3131 100644 --- a/src/data/infrastructure.test.mjs +++ b/src/data/infrastructure.test.mjs @@ -6,6 +6,7 @@ import { createInfrastructureLayers } from 'gods-eye-view/infrastructure'; import { createLocalGeoJsonLayer } from 'gods-eye-view/infrastructure/geojson'; import { fakeInput } from '../input/testDoubles.mjs'; import { bindFakeGroundRenderer } from '../testSupport/fakeGroundRenderer.mjs'; +import { parseGeojsonLines } from '../sources/infrastructureData.js'; function services() { const records = new Map(); @@ -34,6 +35,20 @@ function services() { }; } +// Added from the OSM API, not the OpenInfraMap extract: [id, name, OSM +// object, version]. Both must stay polygons: the Dams layer skips +// LineStrings. +const OSM_API_DAMS = [ + [262532166, 'Acaray', 'way/262532166', 7], + [-5671745, 'Represa Yacyretá-Apipé', 'relation/5671745', 2], +]; +const DAMS = parseGeojsonLines( + readFileSync( + new URL('./local_data/dams/dams.geojsonl', import.meta.url), + 'utf8', + ), +); + test('package exports import without an application, DOM, fetch, or timers', () => { const result = spawnSync( process.execPath, @@ -100,29 +115,64 @@ test('dataset URLs still name the complete bundled sources', () => { } }); -test('Acaray and Yacyreta retain unique OSM records in the current GeoJSONL bundle', () => { - const folder = new URL('./local_data/dams/', import.meta.url); - const lines = readFileSync(new URL('dams.geojsonl', folder), 'utf8') - .trim() - .split('\n') - .map(JSON.parse); - for (const [id, name, version] of [ - [262532166, 'Acaray', 7], - [-5671745, 'Represa Yacyretá-Apipé', 2], - ]) { - const matches = lines.filter((feature) => feature.id === id); +test('Acaray and Yacyretá appear once each with OSM provenance', () => { + for (const [id, name, object, version] of OSM_API_DAMS) { + const matches = DAMS.filter((feature) => feature.id === id); assert.equal(matches.length, 1); - assert.equal(matches[0].properties.name, name); - assert.equal(matches[0].properties.source_version, version); - assert.equal(matches[0].properties.osm_id, id); - assert.match( - matches[0].properties.source_url, - /^https:\/\/www.openstreetmap.org\//, + const { properties } = matches[0]; + assert.equal(properties.name, name); + assert.equal(properties.osm_id, id); + assert.equal(properties.source_version, version); + assert.equal( + properties.source_url, + `https://www.openstreetmap.org/${object}`, ); - assert.ok(Array.isArray(matches[0].geometry.coordinates)); + assert.equal(properties.retrieved_at, '2026-10-15'); } }); +test('Acaray and Yacyretá each get a stem, a selection context and an analyst record', async (t) => { + const added = DAMS.filter((feature) => + OSM_API_DAMS.some(([id]) => id === feature.id), + ); + t.mock.method(globalThis, 'fetch', async () => ({ + ok: true, + text: async () => + added.map((feature) => JSON.stringify(feature)).join('\n'), + })); + const host = services(); + const layer = createLocalGeoJsonLayer( + { + id: 'local-dams', + name: 'Dams', + osmDerived: true, + color: '#0088ff', + url: '/dams.geojsonl', + }, + host, + ); + const viewer = { + scene: { screenSpaceCameraController: { enableInputs: true } }, + }; + const fake = bindFakeGroundRenderer(viewer); + fakeInput(viewer); + t.after(() => layer.destroy(viewer)); + await layer.enable(viewer); + const names = OSM_API_DAMS.map(([, name]) => name).sort(); + assert.equal(fake.set('stems').items.size, 2, 'both dams get a stem'); + assert.deepEqual( + [...host.records.values()].map((record) => record.label).sort(), + names, + ); + assert.deepEqual( + layer + .getAnalystRecords() + .map((record) => record.name) + .sort(), + names, + ); +}); + test('two viewers use their supplied contexts and dispose independently', async (t) => { t.mock.method(globalThis, 'fetch', async () => ({ ok: true, diff --git a/src/data/local_data/dams/README.md b/src/data/local_data/dams/README.md index 27b3207ec8..6695ccde5d 100644 --- a/src/data/local_data/dams/README.md +++ b/src/data/local_data/dams/README.md @@ -16,20 +16,15 @@ The public-release snapshot removes contact-oriented fields and note values that contain email or phone identifiers. The runtime layer does not display or depend on those fields. +## OSM API additions -## Paraguay additions (2026-10-15) +Two dams come from the public OpenStreetMap API rather than the extract: -The existing extract is supplemented with two OpenStreetMap features fetched -through the public OSM API, under the same ODbL 1.0 license: +- Acaray: [way 262532166](https://www.openstreetmap.org/way/262532166), its closed outline of nine nodes. +- Represa Yacyretá-Apipé: [relation 5671745](https://www.openstreetmap.org/relation/5671745), its eight outer ways joined into one closed outline. -- Acaray: [way 262532166](https://www.openstreetmap.org/way/262532166), original closed dam outline, stored as a polygon from the way's nine nodes. -- Represa Yacyretá-Apipé: [relation 5671745](https://www.openstreetmap.org/relation/5671745), original dam outline. Its eight outer ways are joined by shared node IDs into one closed polygon; no reservoir or duplicate power-plant footprint is added. +Both are under the same ODbL 1.0; the relation keeps the extract's negative ID (-5671745). +Keep both as polygons: the Dams layer skips LineStrings. -Each feature preserves the OSM name/tags and records its source URL, parent -object version and retrieval date. Relation IDs retain the extract's negative-ID -convention. Node metadata and contributor identifiers are not bundled. This is -a static map inventory, not live generation, reservoir level or dam status. - -The layer places a polygon's marker and label at the centre of its bounding -sphere. The Yacyretá outline is L-shaped, so its marker sits about 1.6 km from -the outline, over the reservoir. +The layer puts a polygon's marker at the centre of its bounding sphere. The Yacyretá outline is L-shaped, so its +marker sits about 1.6 km from the outline, over the reservoir. diff --git a/src/tools/queries/infrastructure.test.mjs b/src/tools/queries/infrastructure.test.mjs index d2f209793c..3c4d8a275d 100644 --- a/src/tools/queries/infrastructure.test.mjs +++ b/src/tools/queries/infrastructure.test.mjs @@ -119,6 +119,10 @@ test('datacenters and dams are listed nearest first with their own fields', asyn lon: -114.737, distance_km: 3.8, }); + assert.equal( + dams.data.attribution, + '© OpenStreetMap contributors (ODbL 1.0) + Open Infrastructure Map', + ); }); test('the bundled datasets load through the local fetch', async () => { @@ -135,6 +139,8 @@ test('the bundled datasets load through the local fetch', async () => { (record) => Number.isFinite(record.lat) && Number.isFinite(record.lon), ), ); + for (const name of ['Acaray', 'Represa Yacyretá-Apipé']) + assert.equal(dams.filter((record) => record.name === name).length, 1, name); assert.equal(await source.getRecords('local-dams'), dams); await assert.rejects( source.getRecords('local-other'),