Show bg=photo apart from bg=satellite, on the service's layers
The operator, after seeing real posters: EOX's 2016 mosaic is rejected, and a layout's Commons photo now serves only an explicit bg=photo, which falls back to what bg=satellite draws. The picker therefore puts the satellite-or-map choice first, per layout, on the layers the service uses (PDOK HR, IGN's frozen BD ORTHO 2021-2023, USGS, EOxCloudless 2025), and offers the photos as optional for bg=photo. One picks entry may carry a photo, "use": "map", or both, and each choice keeps the other half. The builder and the posters page offer bg=photo; width starts at 400; the licences page sets the options in "used for" as code. Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
This commit is contained in:
+85
-66
@@ -39,10 +39,12 @@
|
||||
<main>
|
||||
<h1>Photo picker</h1>
|
||||
<p class="lead">
|
||||
A race poster over <code>bg=satellite</code> uses a layout’s picked Wikimedia Commons photo when it has one, and a
|
||||
season poster shows that season’s cars only from a picked photo. This page shows the candidates
|
||||
Per layout, the main choice is what <code>bg=satellite</code> draws: the country’s own aerial photo or
|
||||
EOxCloudless 2025, or the dark map instead. A layout may also have a Wikimedia Commons photo picked for
|
||||
<code>bg=photo</code>, which falls back to what <code>bg=satellite</code> draws while none is picked; a season poster
|
||||
shows that season’s cars only from a picked photo. The photos are the candidates
|
||||
<code>tools/commons_candidates.py</code> found, cropped to the poster’s frame as the service crops them, in natural
|
||||
colour or black and white. Choosing one gives the entry to copy into the picks file. The page writes nothing to the
|
||||
colour or black and white. Each choice gives the entry to copy into the picks file. The page writes nothing to the
|
||||
server: a pick is a change to the repository.
|
||||
</p>
|
||||
<p>
|
||||
@@ -106,10 +108,10 @@
|
||||
</section>
|
||||
|
||||
<div id="photos-root">
|
||||
<h2 id="sat-title" hidden>bg=satellite: the satellite, or the map</h2>
|
||||
<div id="sat"></div>
|
||||
<h2 id="others-title">Picks of the circuit’s other layouts</h2>
|
||||
<div id="others"></div>
|
||||
<h2 id="sat-title" hidden>Without a photo: the satellite, or the map</h2>
|
||||
<div id="sat"></div>
|
||||
<h2 id="cands-title">Candidates</h2>
|
||||
<div id="cands"></div>
|
||||
</div>
|
||||
@@ -301,11 +303,16 @@
|
||||
|
||||
/** A pick as the picks file holds it: a photo, or {"use": "map"}. */
|
||||
function pickCard(entry, label, picked) {
|
||||
if (typeof entry.file === 'string' && entry.use === 'map') {
|
||||
const card = photoCard({ ...entry, thumb: thumbOf(entry.file) }, { label, picked });
|
||||
card.querySelector('.name').after(h('div', { class: 'tags' }, h('span', { class: 'tag', title: 'Its entry also says "use": "map"' }, 'the dark map for bg=satellite')));
|
||||
return card;
|
||||
}
|
||||
if (entry.use === 'map') {
|
||||
return h('article', { class: `photo-card${picked ? ' picked' : ''}` },
|
||||
h('div', { class: 'map-frame plain' }, h('span', {}, 'The dark map')),
|
||||
h('div', { class: 'meta' }, h('b', {}, label)),
|
||||
h('div', { class: 'name' }, '{"use": "map"}'));
|
||||
h('div', { class: 'name' }, '{"use": "map"}: the dark map for bg=satellite'));
|
||||
}
|
||||
return photoCard({ ...entry, thumb: thumbOf(entry.file) }, { label, picked });
|
||||
}
|
||||
@@ -350,42 +357,67 @@
|
||||
return h('div', { class: 'copy-block' }, h('div', { class: 'head' }, h('span', {}, title), button), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry a choice leaves for a key, from the one there now: one entry may carry the photo fields (bg=photo),
|
||||
* "use": "map" (bg=satellite), or both. Choosing a photo keeps "use": "map"; the map keeps the photo; keeping the
|
||||
* satellite drops only "use". null: no entry is left.
|
||||
*/
|
||||
function entryFor(existing, kind, cand) {
|
||||
const photo = existing && typeof existing.file === 'string'
|
||||
? Object.fromEntries(PICK_FIELDS.filter((k) => k in existing).map((k) => [k, existing[k]])) : null;
|
||||
const map = !!existing && existing.use === 'map';
|
||||
if (kind === 'photo') return { ...entryOf(cand), ...(map ? { use: 'map' } : {}) };
|
||||
if (kind === 'map') return { ...(photo || {}), use: 'map' };
|
||||
return photo;
|
||||
}
|
||||
|
||||
/** What of the entry there now a choice keeps, said in one sentence. */
|
||||
function keeps(existing, kind) {
|
||||
if (!existing) return '';
|
||||
if (kind === 'photo' && existing.use === 'map') return ' It keeps "use": "map" for bg=satellite.';
|
||||
if (kind === 'map' && typeof existing.file === 'string') return ' It keeps the photo picked for bg=photo.';
|
||||
if (kind === 'satellite') return ' It keeps the photo picked for bg=photo, without "use".';
|
||||
return '';
|
||||
}
|
||||
|
||||
function showEntry() {
|
||||
const section = $('entry');
|
||||
const body = $('entry-body');
|
||||
if (!state.chosen) { section.hidden = true; return; }
|
||||
const { key, cand, fileName, fileKey, kind } = state.chosen;
|
||||
const file = state.picks[fileKey];
|
||||
const existing = file && Object.prototype.hasOwnProperty.call(file, key) ? file[key] : null;
|
||||
const entry = entryFor(existing, kind, cand);
|
||||
const rule = [' ', h('a', { href: F1.linkWithKept('licences.html') }, 'The licences page'), ' states the rule.'];
|
||||
const parts = [];
|
||||
const what = kind === 'satellite' ? 'the satellite, not the map' : kind === 'map' ? 'the dark map instead of the satellite' : cand.file;
|
||||
const parts = [h('p', {}, 'For ', h('code', {}, key), ': ', h('b', {}, what), '.')];
|
||||
if (entry) {
|
||||
parts.push(
|
||||
h('p', {}, 'Copy the entry into ', h('code', {}, fileName), ', or the whole file below with the entry in place.', keeps(existing, kind)),
|
||||
copyBlock(`The entry, for ${fileName}`, `${JSON.stringify(key)}: ${JSON.stringify(entry, null, 2)}`));
|
||||
} else if (!file) {
|
||||
parts.push(h('p', {}, 'No entry is needed for it.'));
|
||||
} else if (existing) {
|
||||
parts.push(h('p', {}, `No entry is left for it: remove the one ${fileName} has now.`));
|
||||
} else {
|
||||
parts.push(h('p', { class: 'hint' }, `No entry is needed for it, and ${fileName} has none: nothing to change.`));
|
||||
}
|
||||
if (kind === 'satellite') {
|
||||
const src = satelliteSource(key);
|
||||
const has = file && Object.prototype.hasOwnProperty.call(file, key);
|
||||
parts.push(h('p', {}, 'Keep the satellite for ', h('code', {}, key), ': no entry. Without a picked photo, ', h('code', {}, 'bg=satellite'),
|
||||
` draws ${src.name}; a poster from it is ${src.poster}.`), notice('info', 'A picture’s licence follows its sources.', ...rule));
|
||||
if (!file) parts.push(notice('error', `${fileName} was not read, so the page cannot say whether it has an entry for this layout to remove.`));
|
||||
else if (has) parts.push(h('p', {}, `${fileName} has an entry for it now: remove it. The whole file without it:`), copyBlock(`The whole of ${fileName} without an entry for ${key}`, withPick(file, key, null)));
|
||||
else parts.push(h('p', { class: 'hint' }, `${fileName} has no entry for it: nothing to change.`));
|
||||
parts.push(notice('info', `bg=satellite draws ${src.name} for this layout; a poster from it is ${src.poster}. A picture’s licence follows its sources.`, ...rule));
|
||||
} else if (kind === 'map') {
|
||||
parts.push(notice('info', 'The service draws the dark OpenStreetMap map for this layout in place of the satellite: for bg=satellite, and for bg=photo while no photo is picked. A poster on it is CC BY 4.0.', ...rule));
|
||||
} else {
|
||||
const entry = kind === 'map' ? { use: 'map' } : entryOf(cand);
|
||||
parts.push(
|
||||
h('p', {}, 'For ', h('code', {}, key), ': ', h('b', {}, kind === 'map' ? 'the dark map instead of the satellite' : cand.file), '. Copy the entry into ', h('code', {}, fileName),
|
||||
', or the whole file below with the entry in place.'),
|
||||
copyBlock(`The entry, for ${fileName}`, `${JSON.stringify(key)}: ${JSON.stringify(entry, null, 2)}`));
|
||||
if (kind === 'map') {
|
||||
parts.push(notice('info', 'With this entry and no picked photo, the service draws the dark OpenStreetMap map for this layout where bg=satellite is asked. A poster on it is CC BY 4.0.', ...rule));
|
||||
} else {
|
||||
const sa = /\bBY-SA\b/i.test(cand.licence);
|
||||
parts.push(notice('info', sa
|
||||
? `${cand.licence} is share-alike: a poster made from it is adapted material, shared under CC BY-SA terms. Such a poster is CC BY-SA 4.0.`
|
||||
: `A poster made from it is CC BY 4.0: a picture’s licence follows its sources, and ${cand.licence} asks no share-alike.`, ...rule));
|
||||
if ((cand.restrictions || []).length) {
|
||||
parts.push(notice('', `Commons names ${cand.restrictions.join(' and ')} rights for this file: rights beside its copyright licence, such as a person’s likeness or a trade mark shown in it.`));
|
||||
}
|
||||
const sa = /\bBY-SA\b/i.test(cand.licence);
|
||||
parts.push(notice('info', fileKey === 'circuits' ? 'This photo serves bg=photo only; bg=satellite does not change. ' : '', sa
|
||||
? `${cand.licence} is share-alike: a poster made from it is adapted material, shared under CC BY-SA terms. Such a poster is CC BY-SA 4.0.`
|
||||
: `A poster made from it is CC BY 4.0: a picture’s licence follows its sources, and ${cand.licence} asks no share-alike.`, ...rule));
|
||||
if ((cand.restrictions || []).length) {
|
||||
parts.push(notice('', `Commons names ${cand.restrictions.join(' and ')} rights for this file: rights beside its copyright licence, such as a person’s likeness or a trade mark shown in it.`));
|
||||
}
|
||||
if (file) parts.push(copyBlock(`The whole of ${fileName} with this entry`, withPick(file, key, entry)));
|
||||
else parts.push(notice('error', `${fileName} was not read, so the whole file cannot be shown: copy the entry, or load the file from disk above.`));
|
||||
}
|
||||
if (!file) parts.push(notice('error', `${fileName} was not read, so the whole file cannot be shown${kind === 'photo' ? '' : ', nor whether it has an entry for this layout now'}: load it from disk above.`));
|
||||
else if (entry || existing) parts.push(copyBlock(`The whole of ${fileName} ${entry ? 'with this entry' : 'without an entry for it'}`, withPick(file, key, entry)));
|
||||
body.replaceChildren(...parts);
|
||||
section.hidden = false;
|
||||
}
|
||||
@@ -416,40 +448,29 @@
|
||||
|
||||
// ------------------------------------------------------------ without a photo: the satellite, or the map
|
||||
|
||||
// The satellite chain without a pick (docs/posters.md, Sources): the country's own aerial photo, else EOxCloudless
|
||||
// (its 2016 mosaic for a layout raced in or before 2016, else the newest). Tile addresses as each provider serves
|
||||
// them, checked 2026-11-27; past maxNativeZoom Leaflet scales the deepest tiles up.
|
||||
// What bg=satellite draws (the operator, 2026-11-27): the country's own aerial photo, else EOxCloudless 2025; a
|
||||
// Commons photo only ever for bg=photo. The layers the service uses; past maxNativeZoom (the deepest level every
|
||||
// circuit of that country has, checked 2026-11-27) Leaflet scales the deepest tiles up.
|
||||
const NATIONAL = {
|
||||
netherlands: { name: 'PDOK’s aerial photo', url: 'https://service.pdok.nl/hwh/luchtfotorgb/wmts/v1_0/Actueel_ortho25/EPSG:3857/{z}/{x}/{y}.jpeg',
|
||||
netherlands: { name: 'PDOK’s aerial photo', url: 'https://service.pdok.nl/hwh/luchtfotorgb/wmts/v1_0/Actueel_orthoHR/EPSG:3857/{z}/{x}/{y}.jpeg',
|
||||
maxNativeZoom: 19, credit: 'Luchtfoto: PDOK / Beeldmateriaal Nederland', licence: 'CC BY 4.0', poster: 'CC BY 4.0' },
|
||||
france: { name: 'IGN’s BD ORTHO', url: 'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=image/jpeg',
|
||||
maxNativeZoom: 19, credit: '© IGN – BD ORTHO', licence: 'Licence Ouverte (Etalab) 2.0', poster: 'CC BY 4.0' },
|
||||
france: { name: 'IGN’s BD ORTHO 2021–2023', url: 'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS2021-2023&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=image/jpeg',
|
||||
maxNativeZoom: 18, credit: '© IGN – BD ORTHO, 2021–2023', licence: 'Licence Ouverte (Etalab) 2.0', poster: 'CC BY 4.0' },
|
||||
'united-states': { name: 'USGS imagery', url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}',
|
||||
maxNativeZoom: 16, credit: 'Imagery: USGS', licence: 'public domain', poster: 'CC BY 4.0' },
|
||||
};
|
||||
const NEWEST_EOX = 2025;
|
||||
const EOX = {
|
||||
name: 'EOxCloudless 2025',
|
||||
url: 'https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2025_3857/default/g/{z}/{y}/{x}.jpg',
|
||||
maxNativeZoom: 15,
|
||||
credit: 'EOxCloudless https://cloudless.eox.at by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2025)',
|
||||
licence: 'CC BY-NC-SA 4.0',
|
||||
poster: 'CC BY-NC-SA 4.0',
|
||||
};
|
||||
|
||||
function eox(year) {
|
||||
return {
|
||||
name: `EOxCloudless ${year}`,
|
||||
url: `https://tiles.maps.eox.at/wmts/1.0.0/${year === 2016 ? 's2cloudless_3857' : `s2cloudless-${year}_3857`}/default/g/{z}/{y}/{x}.jpg`,
|
||||
maxNativeZoom: 15,
|
||||
credit: `EOxCloudless https://cloudless.eox.at by EOX IT Services GmbH (Contains modified Copernicus Sentinel data ${year})`,
|
||||
licence: year === 2016 ? 'CC BY 4.0' : 'CC BY-NC-SA 4.0',
|
||||
poster: year === 2016 ? 'CC BY 4.0' : 'CC BY-NC-SA 4.0',
|
||||
};
|
||||
}
|
||||
|
||||
/** The EOX mosaic of a layout: 2016 for one raced in or before 2016, else the newest. */
|
||||
function eoxOf(layout) {
|
||||
const last = layout.endsWith('-') ? Infinity : parseInt(layout.split('-')[1] || layout, 10);
|
||||
return eox(last <= 2016 ? 2016 : NEWEST_EOX);
|
||||
}
|
||||
|
||||
/** What bg=satellite draws for a layout with no picked photo. */
|
||||
/** What bg=satellite draws for a layout that does not ask for the map. */
|
||||
function satelliteSource(key) {
|
||||
const [country, , , layout] = key.split('/');
|
||||
return NATIONAL[country] || eoxOf(layout);
|
||||
return NATIONAL[key.split('/')[0]] || EOX;
|
||||
}
|
||||
|
||||
const traces = new Map();
|
||||
@@ -544,10 +565,9 @@
|
||||
const sig = `${key}|${frameNow()}`;
|
||||
const src = satelliteSource(key);
|
||||
const status = !state.picks.circuits ? 'circuits/photos.json was not read, so what this layout uses now is not known.'
|
||||
: !current ? `No entry: without a photo, bg=satellite draws ${src.name} for it now.`
|
||||
: current.use === 'map' ? 'Its entry says {"use": "map"}: it uses the dark map now.'
|
||||
: `A photo is picked for it (${current.file}), so neither is used now.`;
|
||||
const head = h('p', { class: 'hint' }, `Without a picked photo, bg=satellite draws ${src.name} for this layout. Judge it below, its trace drawn in white: keep the satellite, or have the service draw the dark map instead. `, h('b', {}, status));
|
||||
: current && current.use === 'map' ? 'Its entry says "use": "map": bg=satellite draws the dark map for it now.'
|
||||
: `Its entry does not ask for the map: bg=satellite draws ${src.name} for it now.`;
|
||||
const head = h('p', { class: 'hint' }, `bg=satellite draws ${src.name} for this layout, and bg=photo does too while it has no picked photo. Judge it below, its trace drawn in white: keep the satellite, or have the service draw the dark map instead. `, h('b', {}, status));
|
||||
const choices = h('div', { class: 'choices' },
|
||||
h('button', { type: 'button', 'data-kind': 'satellite', onclick: () => chooseSurface(key, 'satellite') }, 'Keep the satellite (no entry)'),
|
||||
h('button', { type: 'button', 'data-kind': 'map', onclick: () => chooseSurface(key, 'map') }, 'Use the map instead'));
|
||||
@@ -563,8 +583,7 @@
|
||||
const country = p.country;
|
||||
const cards = [];
|
||||
if (NATIONAL[country]) cards.push(mapCard(NATIONAL[country], 'What bg=satellite draws for this country'));
|
||||
const e = eoxOf(p.layout);
|
||||
cards.push(mapCard(e, NATIONAL[country] ? 'What bg=satellite draws where the national photo has no tiles' : 'What bg=satellite draws here'));
|
||||
cards.push(mapCard(EOX, NATIONAL[country] ? 'What bg=satellite draws where the national photo has no tiles' : 'What bg=satellite draws here'));
|
||||
cards.push(serviceCard(p));
|
||||
$('sat').replaceChildren(head, grid(cards), choices);
|
||||
markChoices();
|
||||
@@ -631,7 +650,7 @@
|
||||
|
||||
// The circuit's other layouts, and this one's pick when it has one.
|
||||
$('others-title').hidden = false;
|
||||
$('others-title').textContent = `Picks of ${p.circuitName || 'this circuit'}’s layouts`;
|
||||
$('others-title').textContent = `For bg=photo (optional): the picks of ${p.circuitName || 'this circuit'}’s layouts`;
|
||||
if (!picks) {
|
||||
$('others').replaceChildren(notice('error', 'circuits/photos.json was not read (see 1), so the picks are not shown.'));
|
||||
} else {
|
||||
@@ -645,14 +664,14 @@
|
||||
}
|
||||
|
||||
const undated = ((state.candidates.about || {}).undated_per_circuit || {})[circuitKey];
|
||||
$('cands-title').textContent = `Candidates for ${layoutYears(p.layout)}${list ? ` (${list.length})` : ''}`;
|
||||
$('cands-title').textContent = `Candidates for bg=photo (optional), ${layoutYears(p.layout)}${list ? ` (${list.length})` : ''}`;
|
||||
if (!list) {
|
||||
$('cands').replaceChildren(notice('error', `The candidates file has no entry for ${key}: run tools/commons_candidates.py again.`));
|
||||
return;
|
||||
}
|
||||
const why = undated ? ` The tool found ${undated} more photo${undated === 1 ? '' : 's'} of this circuit with no date it can read; a layout lists only photos dated within its years.` : '';
|
||||
if (!list.length) {
|
||||
$('cands').replaceChildren(notice('', `Commons has no freely licensed aerial photo of this circuit dated ${layoutYears(p.layout)} that the tool found: the layout keeps the satellite or uses the map (above).${why}`));
|
||||
$('cands').replaceChildren(notice('', `Commons has no freely licensed aerial photo of this circuit dated ${layoutYears(p.layout)} that the tool found: bg=photo draws what bg=satellite draws for it (above).${why}`));
|
||||
return;
|
||||
}
|
||||
$('cands').replaceChildren(
|
||||
|
||||
Reference in New Issue
Block a user