mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Add OpenSeaMap / OpenSnowMap overlay layers (#10)
Two independently toggleable open-data raster overlays — OpenSeaMap sea marks (buoys, lighthouses, ports) and OpenSnowMap ski pistes — drawn as Cesium.ImageryLayers directly on the Cesium globe surface. Same "small array of descriptors" shape as MAP_STACKS in mapStackController.js. Visible on the osm/bing-aerial/bing-labels map stacks and invisible (not broken — the layer's stats say so in plain text) on the default photoreal stack, since Google Photorealistic 3D Tiles render with the globe hidden. OpenRailwayMap and OpenInfraMap, also requested in #10, are deliberately NOT included in this pass: OpenRailwayMap's public tile server enforces a Referer allowlist scoped to its own site (confirmed by direct request — every other Referer, including none, 403s), and OpenInfraMap serves MapLibre GL vector tiles, not raster XYZ — that would need a genuine vector-tile rendering pipeline, not a Cesium.ImageryLayer drop-in. Worth its own dedicated pass. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
1 parent
db49edf363
commit
feba5af0b9
8 files changed
+270
-2
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
OSM_OVERLAYS,
|
||||
applyOsmOverlayParams,
|
||||
osmOverlaysHiddenReason,
|
||||
} from './osmOverlays.js';
|
||||
|
||||
test('OSM_OVERLAYS: exactly the two shipped overlays, each with a tile template and credit', () => {
|
||||
assert.deepEqual(OSM_OVERLAYS.map((o) => o.key), ['seamap', 'snowmap']);
|
||||
for (const overlay of OSM_OVERLAYS) {
|
||||
assert.match(overlay.urlTemplate, /\{z\}.*\{x\}.*\{y\}/);
|
||||
assert.ok(overlay.credit);
|
||||
}
|
||||
});
|
||||
|
||||
test('osmOverlaysHiddenReason: null when disabled, nothing chosen, or the globe is shown', () => {
|
||||
assert.equal(osmOverlaysHiddenReason(false, { seamap: true, snowmap: true }, false), null);
|
||||
assert.equal(osmOverlaysHiddenReason(true, { seamap: false, snowmap: false }, false), null);
|
||||
assert.equal(osmOverlaysHiddenReason(true, { seamap: true, snowmap: false }, true), null);
|
||||
});
|
||||
|
||||
test('osmOverlaysHiddenReason: explains itself when enabled + chosen but the photoreal globe is hidden', () => {
|
||||
const reason = osmOverlaysHiddenReason(true, { seamap: true, snowmap: false }, false);
|
||||
assert.ok(reason && /globe/i.test(reason));
|
||||
});
|
||||
|
||||
test('applyOsmOverlayParams: flips only known keys with boolean values, reports whether anything changed', () => {
|
||||
const current = { seamap: true, snowmap: true };
|
||||
const a = applyOsmOverlayParams(current, { seamap: false });
|
||||
assert.deepEqual(a.next, { seamap: false, snowmap: true });
|
||||
assert.equal(a.changed, true);
|
||||
|
||||
const b = applyOsmOverlayParams(current, { seamap: true });
|
||||
assert.deepEqual(b.next, current);
|
||||
assert.equal(b.changed, false);
|
||||
|
||||
const c = applyOsmOverlayParams(current, { unknownKey: false, snowmap: 'nope' });
|
||||
assert.deepEqual(c.next, current);
|
||||
assert.equal(c.changed, false);
|
||||
});
|
||||
Reference in new issue
Block a user