more national imagery

This commit is contained in:
vcoppe committed 2026-11-29 22:25:45 +01:00
1 parent 9372df1c61
commit 3ac084be65
5 files changed
+60 -1

No files matched your search

@@ -82,6 +82,27 @@ describe('planTile', () => {
parts: ['BE:partial', 'NL:partial'],
fallback: false,
});
// Elvas and Badajoz, on the border of Portugal and Spain
assert.deepEqual(await plan([13, 3935, 3135], tiles), {
parts: ['ES:partial', 'PT:partial'],
fallback: false,
});
});
it('takes a country from its agency next to one without open imagery', async () => {
const { tiles } = savedTiles();
// Padborg, with Germany to the south
assert.deepEqual(await plan([13, 4309, 2597], tiles), {
parts: ['DK:partial'],
fallback: true,
});
});
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 });
assert.deepEqual(asked, []);
});
it('asks for a tile of the countries once for all the tiles of imagery inside it', async () => {
@@ -29,6 +29,25 @@ const xyz =
(z, x, y) =>
template.replace('{z}', String(z)).replace('{x}', String(x)).replace('{y}', String(y));
/**
* For a WMS: the tile as an image of its bounds in Web Mercator. A WMS that draws nothing below
* the scale of zoom `minzoom` is asked for a larger image there, at that scale.
*/
const wms =
(base: string, minzoom = 0): TileUrl =>
(z, x, y) => {
const half = 20037508.342789244;
const size = (2 * half) / 2 ** z;
const pixels = 256 * 2 ** Math.max(0, minzoom - z);
const bbox = [
x * size - half,
half - (y + 1) * size,
(x + 1) * size - half,
half - y * size,
];
return `${base}&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&STYLES=&CRS=EPSG:3857&WIDTH=${pixels}&HEIGHT=${pixels}&BBOX=${bbox.join(',')}`;
};
const ignOrthophotos = xyz(
'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX={z}&TILECOL={x}&TILEROW={y}'
);
@@ -102,6 +121,23 @@ const sources: ImagerySource[] = [
),
maxzoom: 19,
},
{
// mainland Portugal only, as in the tileset of the countries
id: 'PT',
url: wms(
'https://cartografia.dgterritorio.gov.pt/wms/ortos2025?LAYERS=Ortos2025-RGB&FORMAT=image/jpeg',
// blank at zoom 13
14
),
maxzoom: 19,
},
{
id: 'DK',
url: xyz(
'https://wmts.datafordeler.dk/GeoDanmarkOrto/orto_foraar_webm/1.0.0/WMTS/orto_foraar_webm/default/DFD_GoogleMapsCompatible/{z}/{y}/{x}.jpg?apikey=pDSRuC5YLFT3jHf4XbaWDGSa9Td4TfYiGiB7YfhCKikJhZE6xibJAlaNp1KpDAzHdDss9DSKdq3nNoT2UFU3cmecaLrcRNTOc'
),
maxzoom: 20,
},
];
export const openSatelliteAttribution = [
@@ -114,6 +150,8 @@ export const openSatelliteAttribution = [
'<a href="https://cuzk.gov.cz/" target="_blank">ČÚZK</a>',
'<a href="https://www.ngi.be/" target="_blank">NGI/IGN</a>',
'<a href="https://www.geoportal.gov.pl/" target="_blank">GUGiK</a>',
'<a href="https://www.dgterritorio.gov.pt/" target="_blank">DGT</a>',
'GeoDanmark © <a href="https://klimadatastyrelsen.dk/" target="_blank">Klimadatastyrelsen</a>',
].join(', ');
// Countries, from the tileset of their polygons, built from the borders of OpenStreetMap