more national/regional imagery

This commit is contained in:
vcoppe committed 2026-12-04 18:32:43 +01:00
1 parent 22a269a6dc
commit 2365195bcb
23 files changed
+335 -27

No files matched your search

@@ -119,13 +119,124 @@ describe('planTile', () => {
});
});
it('leaves the islands of Portugal to the fallback', async () => {
const { asked, tiles } = savedTiles();
// Funchal, on Madeira
assert.deepEqual(await plan(tile(-16.91, 32.65, 15), tiles), { parts: [], fallback: true });
it('takes Slovenia, Slovakia and Estonia from their agencies', async () => {
const { tiles } = savedTiles();
// Ljubljana
assert.deepEqual(await plan(tile(14.506, 46.051, 16), tiles), {
parts: ['SI:full'],
fallback: false,
});
// Bad Radkersburg and Gornja Radgona, on the border of Austria and Slovenia
assert.deepEqual(await plan(tile(15.99, 46.685, 13), tiles), {
parts: ['AT:partial', 'SI:partial'],
fallback: false,
});
// Bratislava, on the border of Austria
assert.deepEqual(await plan(tile(17.05, 48.14, 13), tiles), {
parts: ['AT:partial', 'SK:partial'],
fallback: false,
});
// Valga, with Latvia, which is not in the patchwork, to the south
assert.deepEqual(await plan(tile(26.03, 57.777, 13), tiles), {
parts: ['EE:partial'],
fallback: true,
});
});
it('takes Liechtenstein from the agency of Switzerland, with it as one', async () => {
const { tiles } = savedTiles();
// Vaduz
assert.deepEqual(await plan(tile(9.5215, 47.141, 16), tiles), {
parts: ['LI:full'],
fallback: false,
});
// the Rhine, on the border of Switzerland
const { parts, fallback } = await planTile(...tile(9.51, 47.141, 14), tiles);
assert.deepEqual(
parts.map((part) => part.relation),
['full']
);
assert.equal(fallback, false);
// near Schaanwald, on the border of Austria
const border = await plan([14, 8628, 5748], tiles);
assert.deepEqual(border, { parts: ['AT:partial', 'LI:partial'], fallback: false });
});
it('takes Monaco from the agency of France, with it as one', async () => {
const { tiles } = savedTiles();
// the Casino
assert.deepEqual(await plan(tile(7.4281, 43.7392, 18), tiles), {
parts: ['MC:full'],
fallback: false,
});
// La Condamine, on the border of France
const { parts, fallback } = await planTile(...tile(7.4165, 43.7365, 17), tiles);
assert.deepEqual(
parts.map((part) => part.relation),
['full']
);
assert.equal(fallback, false);
});
it('takes Madeira from its own agency, and leaves the Azores to the fallback', async () => {
const { tiles } = savedTiles();
// Funchal
assert.deepEqual(await plan(tile(-16.91, 32.65, 16), tiles), {
parts: ['PT-30:full'],
fallback: false,
});
const { asked, tiles: none } = savedTiles();
// Ponta Delgada
assert.deepEqual(await plan(tile(-25.67, 37.74, 15), none), { parts: [], fallback: true });
assert.deepEqual(asked, []);
});
it('takes the regions of Italy with imagery of the same year as one', async () => {
const { tiles } = savedTiles();
const years = async (...at: [number, number, number]) => {
const [z, x, y] = tile(...at);
const { parts, fallback } = await planTile(z, x, y, tiles);
return {
parts: parts
.map((p) => `${p.source.url(z, x, y).match(/AgEA_(\d+)/)?.[1]}:${p.relation}`)
.sort(),
fallback,
};
};
// Orte, in Lazio, and the Umbrian side of the Tiber
assert.deepEqual(await years(12.386, 42.46, 13), { parts: ['2023:full'], fallback: false });
// the Vatican and Rome
assert.deepEqual(await years(12.4534, 41.9022, 14), {
parts: ['2023:full'],
fallback: false,
});
// Piacenza, in Emilia-Romagna, and Lombardy, north of the Po
assert.deepEqual(await years(9.69, 45.06, 13), {
parts: ['2023:partial', '2024:partial'],
fallback: false,
});
});
it('takes Basilicata from its agency above the last zoom level of its imagery', async () => {
const { tiles } = savedTiles();
// Potenza
assert.deepEqual(await plan(tile(15.805, 40.64, 18), tiles), {
parts: ['IT-77:full'],
fallback: false,
});
// on the border of Campania, whose imagery is closer: as one only up to there
const border = [15.53345, 40.57318] as const;
const { parts } = await planTile(...tile(...border, 16), tiles);
assert.deepEqual(
parts.map((part) => part.relation),
['full']
);
assert.deepEqual(await plan(tile(...border, 17), tiles), {
parts: ['IT-72:partial', 'IT-77:partial'],
fallback: false,
});
});
it('takes New Zealand from its agency, on both sides of the 180th meridian', async () => {
const { tiles } = savedTiles();
// New Plymouth, inland and on the coast, with the fallback at sea
@@ -144,6 +255,39 @@ describe('planTile', () => {
});
});
it('takes Japan from its agency', async () => {
const { tiles } = savedTiles();
// Matsumoto
assert.deepEqual(await plan(tile(137.97, 36.235, 13), tiles), {
parts: ['JP:full'],
fallback: false,
});
// the Shiretoko peninsula, with the fallback at sea
assert.deepEqual(await plan(tile(145.19, 44.02, 14), tiles), {
parts: ['JP:partial'],
fallback: true,
});
});
it('takes Taiwan from its agency, without the islands that have no imagery', async () => {
const { tiles } = savedTiles();
// Yushan
assert.deepEqual(await plan(tile(120.957, 23.47, 14), tiles), {
parts: ['TW:full'],
fallback: false,
});
// Kinmen, with the fallback at sea
assert.deepEqual(await plan(tile(118.29, 24.43, 13), tiles), {
parts: ['TW:partial'],
fallback: true,
});
// Matsu
assert.deepEqual(await plan(tile(119.93, 26.155, 14), tiles), {
parts: [],
fallback: true,
});
});
it('takes the states of the United States with the same imagery as one', async () => {
const { tiles } = savedTiles();
// Kansas City, in Kansas and Missouri, both from the NAIP
@@ -162,15 +306,35 @@ describe('planTile', () => {
parts: ['US-DC:full'],
fallback: false,
});
// Portland, and the Columbia, with Washington, which is not in the patchwork, to the north
// Portland, and the Columbia, with Washington to the north
assert.deepEqual(await plan(tile(-122.68, 45.59, 16), tiles), {
parts: ['US-OR:full'],
fallback: false,
});
assert.deepEqual(await plan([13, 1305, 2927], tiles), {
parts: ['US-OR:partial'],
parts: ['US-OR:partial', 'US-WA:partial'],
fallback: false,
});
});
it('takes the states missing from the server of the USDA from that of GeoPlatform', async () => {
const { tiles } = savedTiles();
// Honolulu, with the fallback at sea
const honolulu = tile(-157.858, 21.307, 16);
assert.deepEqual(await plan(honolulu, tiles), { parts: ['US-HI:full'], fallback: false });
const [part] = (await planTile(...honolulu, tiles)).parts;
assert.match(part.source.url(...honolulu), /^https:\/\/imagery\.geoplatform\.gov\//);
assert.deepEqual(await plan(tile(-157.87, 21.29, 13), tiles), {
parts: ['US-HI:partial'],
fallback: true,
});
// Four Corners, with Arizona and Colorado from there, and New Mexico and Utah from the USDA
const { parts, fallback } = await planTile(...tile(-109.0452, 36.999, 14), tiles);
assert.deepEqual(
parts.map((p) => p.relation),
['partial', 'partial']
);
assert.equal(fallback, false);
});
it('asks for a tile of the countries once for all the tiles of imagery inside it', async () => {