mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 18:22:25 +00:00
fix(dams): store Acaray as a polygon so the layer shows it
Acaray was stored as a LineString, which the Dams layer skips: it got no marker, label, card or analyst record. Store the closed way as a polygon (counter-clockwise ring from the same nine nodes) and add a layer test for both Paraguay dams. Also tidy the dataset README (drop the landing-order notes and the analyst record count, note why the Yacyretá marker sits over the reservoir), keep one credited changelog bullet, credit the OpenStreetMap API next to Open Infrastructure Map, and drop "other" from the Three Gorges mission.
This commit is contained in:
1 parent
6eaa428089
commit
2e2f9ba095
7 files changed
+112
-19
No files matched your search
@@ -0,0 +1,101 @@
|
||||
// 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;
|
||||
}
|
||||
});
|
||||
@@ -14,8 +14,7 @@ this derived database.
|
||||
|
||||
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. Both `dams.geojsonl` and the runtime JSONL form carry the
|
||||
same privacy transform.
|
||||
depend on those fields.
|
||||
|
||||
|
||||
## Paraguay additions (2026-10-15)
|
||||
@@ -23,7 +22,7 @@ same privacy transform.
|
||||
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), original closed dam outline (stored as a LineString).
|
||||
- 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.
|
||||
|
||||
Each feature preserves the OSM name/tags and records its source URL, parent
|
||||
@@ -31,13 +30,6 @@ 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.
|
||||
|
||||
## Regional integration
|
||||
|
||||
The 706 OSM features produce 705 analyst records: existing relation 19953989
|
||||
(`HE Podlubnik - Centrala`) is a MultiLineString without a supported query point.
|
||||
Keep #1009's NVE file and #1149's IGN file separate from this ODbL dataset.
|
||||
The proposed landing order is #1009 → #1152 → #1149; after predecessors land,
|
||||
reconcile the shared source label and docs without replacing the regional list.
|
||||
Together the snapshots contain 706 OSM + 4,141 NVE + 121 IGN = 4,968 source
|
||||
features and 4,967 analyst records. Those are combined expectations, not the
|
||||
contents of this standalone OSM-only branch.
|
||||
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.
|
||||
@@ -703,4 +703,4 @@
|
||||
{"id":405007988,"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[51.592068922,43.199413946],[51.59684602,43.199885177],[51.59724064,43.197759191],[51.593578084,43.197397847],[51.59272137,43.197675623],[51.592397577,43.197643772],[51.592068922,43.199413946]]]},"properties":{"id":33090,"name":"","tags":{"man_made":"wastewater_plant","waterway":"dam"},"type":"wastewater_plant","osm_id":405007988,"source_layer":"osm_wastewater_plant"}}
|
||||
{"id":-19953989,"type":"Feature","geometry":{"type":"MultiLineString","coordinates":[[[14.292237283,46.169084857],[14.292230326,46.169090389],[14.292224878,46.169096341],[14.292219346,46.169103549],[14.292216999,46.169113188],[14.292215322,46.169122744],[14.29221658,46.169131796],[14.292221273,46.169138334],[14.292231918,46.169148225],[14.29223963,46.169150823]],[[14.292171736,46.168911268],[14.292167462,46.168929289],[14.29216654,46.168975893],[14.292183555,46.169023083],[14.292186321,46.169030124],[14.292204593,46.169025933],[14.292237283,46.169084857]],[[14.293466824,46.169211843],[14.293464394,46.169201869],[14.293090644,46.16923657],[14.293067678,46.169224248],[14.293022583,46.169223662],[14.292636178,46.169247718],[14.292563842,46.169209496],[14.292558394,46.169207988],[14.292478766,46.169186446],[14.292457643,46.169185021],[14.292426882,46.169183429],[14.29241347,46.169186446],[14.292388492,46.169203545],[14.292448842,46.169220477],[14.292470384,46.169226428],[14.292521681,46.169242772],[14.292532661,46.169225673],[14.292546659,46.169229529],[14.29256468,46.169234558],[14.292535679,46.169293483],[14.292533499,46.169297925],[14.292576582,46.169300859],[14.292619162,46.169286191],[14.293023422,46.169262554],[14.293072791,46.169259536],[14.293092321,46.169248388],[14.293466824,46.169211843]],[[14.292535679,46.169293483],[14.29249905,46.169285185],[14.292510198,46.169267248],[14.292313977,46.169211927],[14.292318755,46.169203042],[14.29232546,46.169190721],[14.292333256,46.169176472],[14.292290089,46.169164653],[14.292276175,46.169192062],[14.292257986,46.169227769],[14.29231163,46.169241767],[14.292303919,46.169254842],[14.292294196,46.169271439],[14.292207024,46.169244868],[14.292170647,46.169314522],[14.29248589,46.169394736],[14.292518496,46.169328436],[14.292526123,46.169312845],[14.292533499,46.169297925],[14.292535679,46.169293483]],[[14.292426882,46.169183429],[14.292448172,46.169103549],[14.292476838,46.169107153],[14.292457643,46.169185021],[14.292426882,46.169183429]],[[14.292237283,46.169084857],[14.292246922,46.169084941],[14.292247257,46.169081086],[14.292319845,46.169084857],[14.292448172,46.169103549],[14.292476838,46.169107153],[14.292575074,46.169109333],[14.292575493,46.169095838],[14.292480777,46.169093156],[14.292326383,46.169069099],[14.292247341,46.169065747],[14.292242228,46.169055269],[14.292266117,46.169050324],[14.292263099,46.169041858],[14.292231835,46.169048899],[14.292217418,46.169022161],[14.292267374,46.16901336],[14.292264943,46.169006235],[14.292183555,46.169023083],[14.292186321,46.169030124],[14.292204593,46.169025933],[14.292237283,46.169084857]]]},"properties":{"name":"HE Podlubnik - Centrala","tags":{"name":"HE Podlubnik - Centrala","type":"site","power":"plant","alt_name":"HE Škofja Loka","operator":"Elektro Gorenjska","waterway":"dam","start_date":"1969","plant:method":"run-of-the-river","plant:source":"hydro","plant:output:electricity":"330KW"},"osm_id":-19953989,"output":"330KW","source":"hydro","construction":"","source_layer":"power_plant_relation_by_geom_type"}}
|
||||
{"type":"Feature","id":-5671745,"geometry":{"type":"Polygon","coordinates":[[[-56.7356385,-27.4830326],[-56.7356372,-27.4836817],[-56.7356918,-27.4837745],[-56.7356509,-27.4838875],[-56.7355326,-27.4837665],[-56.7354735,-27.4836131],[-56.7353507,-27.4835526],[-56.7353552,-27.4830522],[-56.7354053,-27.483032],[-56.7354041,-27.4829378],[-56.7350345,-27.4826704],[-56.7321442,-27.4826598],[-56.7319588,-27.4828659],[-56.7018972,-27.4827418],[-56.7018797,-27.4821358],[-56.706089,-27.4821869],[-56.7060921,-27.4821089],[-56.7063455,-27.482095],[-56.7063734,-27.4821649],[-56.7090948,-27.482163],[-56.7091818,-27.4821095],[-56.7093995,-27.4820799],[-56.7094201,-27.4821854],[-56.7106196,-27.4821876],[-56.7109955,-27.4820628],[-56.7121754,-27.4820408],[-56.7121751,-27.4817168],[-56.712209,-27.4817165],[-56.7122144,-27.4803221],[-56.7121755,-27.4803209],[-56.7121781,-27.4793322],[-56.7122425,-27.4793286],[-56.7122439,-27.4791204],[-56.7121688,-27.479118],[-56.7121795,-27.4788039],[-56.7122371,-27.4788007],[-56.7122492,-27.4788015],[-56.7122948,-27.4790038],[-56.7123002,-27.4793441],[-56.7123005,-27.4796668],[-56.7124411,-27.4796679],[-56.7125759,-27.4796689],[-56.7125765,-27.47935],[-56.7125805,-27.4792477],[-56.7125939,-27.4790371],[-56.7126422,-27.4788016],[-56.7126649,-27.4788009],[-56.7127186,-27.4788051],[-56.7127213,-27.4791216],[-56.7126462,-27.4791276],[-56.7126516,-27.4793274],[-56.7127079,-27.4793263],[-56.7127072,-27.4803126],[-56.7126744,-27.4803132],[-56.712673,-27.4817118],[-56.7127239,-27.481713],[-56.7127247,-27.4820404],[-56.7132439,-27.4820594],[-56.7135349,-27.4821853],[-56.716431,-27.4821918],[-56.7166924,-27.4821402],[-56.7169096,-27.482192],[-56.7354167,-27.4822992],[-56.7432767,-27.4822775],[-56.7432829,-27.4821624],[-56.7433092,-27.4820925],[-56.7433441,-27.4820092],[-56.743387,-27.4819117],[-56.7433977,-27.481826],[-56.7434058,-27.481362],[-56.743385,-27.4806888],[-56.7435047,-27.4806879],[-56.7435053,-27.480804],[-56.7517581,-27.4808023],[-56.7519858,-27.4807842],[-56.7522074,-27.4807224],[-56.7529074,-27.4805122],[-56.7530675,-27.4804512],[-56.753188,-27.4804018],[-56.7536873,-27.4801667],[-56.7539035,-27.480035],[-56.7540186,-27.4799455],[-56.7546428,-27.4793125],[-56.7548624,-27.4789803],[-56.755134,-27.4784449],[-56.7553243,-27.4776504],[-56.7553385,-27.4775558],[-56.7553453,-27.4773839],[-56.7553663,-27.453364],[-56.756278,-27.4533505],[-56.7566902,-27.4545407],[-56.7565699,-27.4671653],[-56.7566153,-27.4769172],[-56.7565098,-27.4782975],[-56.7561882,-27.4791614],[-56.7557343,-27.4797995],[-56.7548315,-27.4808659],[-56.7541622,-27.4813087],[-56.753515,-27.4815729],[-56.7529038,-27.4817915],[-56.7522708,-27.4819086],[-56.7486914,-27.4820093],[-56.7480953,-27.4820155],[-56.7478466,-27.4820264],[-56.747675,-27.4820455],[-56.7475127,-27.4820919],[-56.7469953,-27.4823096],[-56.7450435,-27.4829093],[-56.7443696,-27.4830283],[-56.7436163,-27.4830891],[-56.7434021,-27.483068],[-56.7396907,-27.4830592],[-56.7396861,-27.4833826],[-56.7394399,-27.4833826],[-56.739439,-27.4830604],[-56.7356385,-27.4830326]]]},"properties":{"name":"Represa Yacyretá-Apipé","tags":{"name":"Represa Yacyretá-Apipé","type":"multipolygon","waterway":"dam"},"osm_id":-5671745,"source_layer":"osm_relation","source_url":"https://www.openstreetmap.org/relation/5671745","source_version":2,"retrieved_at":"2026-10-15"}}
|
||||
{"type":"Feature","id":262532166,"geometry":{"type":"LineString","coordinates":[[-54.6285064,-25.4587626],[-54.6285459,-25.4588065],[-54.6285037,-25.4588762],[-54.6290649,-25.4599721],[-54.6292971,-25.459876],[-54.6287352,-25.4587382],[-54.6286513,-25.458535],[-54.628456,-25.4586556],[-54.6285064,-25.4587626]]},"properties":{"name":"Acaray","tags":{"name":"Acaray","waterway":"dam","wikidata":"Q3433454"},"osm_id":262532166,"source_layer":"osm_way","source_url":"https://www.openstreetmap.org/way/262532166","source_version":7,"retrieved_at":"2026-10-15"}}
|
||||
{"type":"Feature","id":262532166,"geometry":{"type":"Polygon","coordinates":[[[-54.6285064,-25.4587626],[-54.628456,-25.4586556],[-54.6286513,-25.458535],[-54.6287352,-25.4587382],[-54.6292971,-25.459876],[-54.6290649,-25.4599721],[-54.6285037,-25.4588762],[-54.6285459,-25.4588065],[-54.6285064,-25.4587626]]]},"properties":{"name":"Acaray","tags":{"name":"Acaray","waterway":"dam","wikidata":"Q3433454"},"osm_id":262532166,"source_layer":"osm_way","source_url":"https://www.openstreetmap.org/way/262532166","source_version":7,"retrieved_at":"2026-10-15"}}
|
||||
Reference in new issue
Block a user