Write the operator's decisions and the lead's answers into the design

Since the first draft: Commons photos left bg=satellite for an explicit
bg=photo; EOX's 2016 mosaic was rejected for the newest; IGN takes its
frozen 2021-2023 mosaic; a layout can be switched to the map; photo
treatments are natural (default) or bw; a picture's licence follows its
sources; and the builders' questions (presets per frame, placement, dim,
season options, the picks' key and shape, header folding, the smallest
width) are answered where they belong.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
This commit is contained in:
2026-11-27 15:21:24 +01:00
parent 812b01b9dd
commit d32e57ec41
+96 -60
View File
@@ -2,8 +2,9 @@
How F1 Circuits makes its race posters, season posters and session thumbnails: where every picture comes How F1 Circuits makes its race posters, season posters and session thumbnails: where every picture comes
from and under which licence, what it fetches once and keeps, what it draws on every request, which options a from and under which licence, what it fetches once and keeps, what it draws on every request, which options a
caller has, and how every image says where it comes from. Decided with the operator on 2026-11-27; the licence caller has, and how every image says where it comes from. Decided with the operator on 2026-11-27, after
reading behind it quotes each source's own terms. reading each source's own terms; the lead's answers to the builders' questions are written in where they
belong.
## Principles ## Principles
@@ -12,62 +13,70 @@ reading behind it quotes each source's own terms.
2. **Static is kept.** The circuits, their layouts and finished seasons do not change, so what is made from 2. **Static is kept.** The circuits, their layouts and finished seasons do not change, so what is made from
them is fetched or rendered once and kept. Nothing expires; a changed input makes a new key. them is fetched or rendered once and kept. Nothing expires; a changed input makes a new key.
3. **Heavy once, light every time.** What needs the network (a map, a photo) is a kept layer. What a caller 3. **Heavy once, light every time.** What needs the network (a map, a photo) is a kept layer. What a caller
can choose (texts, colours, size, format) is drawn on the fly from the kept layers. can choose (texts, colours, treatment, size, format) is drawn on the fly from the kept layers.
4. **Whole or not at all.** A layer is kept only when every part of it arrived. A picture whose layer did not 4. **Whole or not at all.** A layer is kept only when every part of it arrived. A picture whose layer did not
arrive is served without it, for five minutes, and not kept. arrive is served without it, for five minutes, and not kept.
## Sources ## Sources
Only sources whose licence allows keeping a copy for good (the operator's first tier) are used. Esri, Bing, Only sources whose licence allows keeping a copy for good are used. Esri, Bing, Azure Maps, Google, Mapbox and
Azure Maps, Google, Mapbox and MapTiler are not: their terms forbid automated fetching, keeping, or serving MapTiler are not: their terms forbid automated fetching, keeping, or serving images made from their maps to the
images made from their maps to the public. public.
| Source | Used for | Licence | Credit drawn on the image | | Source | Used for | Licence | Credit drawn on the image |
|:---|:---|:---|:---| |:---|:---|:---|:---|
| Wikimedia Commons aerial photo, picked per layout | `bg=satellite` where a pick exists | per file: CC0, public domain, CC BY or CC BY-SA only | `Photo: <author>, <licence>, via Wikimedia Commons` | | USGS imagery (USGSImageryOnly, to zoom 16), United States | `bg=satellite` for circuits in the US | public domain | `USDA, USGS The National Map: Orthoimagery` |
| USGS imagery (NAIP), United States | `bg=satellite` for circuits in the US | public domain | `Imagery: USGS` | | PDOK aerial photo (Actueel_orthoHR), the Netherlands | `bg=satellite` for circuits in the Netherlands | CC BY 4.0 | `Luchtfoto: PDOK / Samenwerkingsverband Beeldmateriaal, CC BY 4.0` |
| PDOK aerial photo, the Netherlands | `bg=satellite` for circuits in the Netherlands | CC BY 4.0 | `Luchtfoto: PDOK / Beeldmateriaal Nederland` | | IGN, the frozen mosaic ORTHOIMAGERY.ORTHOPHOTOS2021-2023, France | `bg=satellite` for circuits in France | Licence Ouverte (Etalab) 2.0 | `© IGN – BD ORTHO, 2021–2023` |
| IGN BD ORTHO, France | `bg=satellite` for circuits in France | Licence Ouverte (Etalab) 2.0 | `© IGN – BD ORTHO` | | EOxCloudless, the newest mosaic (2025) | `bg=satellite` everywhere else | CC BY-NC-SA 4.0 | `EOxCloudless https://cloudless.eox.at by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2025)` |
| EOxCloudless (Sentinel-2, 10 m) | `bg=satellite` everywhere else | 2016: CC BY 4.0; later years: CC BY-NC-SA 4.0 | `EOxCloudless https://cloudless.eox.at by EOX IT Services GmbH (Contains modified Copernicus Sentinel data <year>)` | | OpenStreetMap standard tiles | `bg=osm`, `bg=dark`, `bg=light` (recoloured), the world locator, and a layout switched to the map | ODbL (data), tile usage policy | `© OpenStreetMap contributors` |
| OpenStreetMap standard tiles | `bg=osm`, `bg=dark`, `bg=light` (recoloured), the world locator | ODbL (data), tile usage policy | `© OpenStreetMap contributors` | | Wikimedia Commons photo, picked per layout or per season | `bg=photo`; season posters | per file: CC0, public domain, CC BY or CC BY-SA only | `Photo: <author>, <licence>, via Wikimedia Commons` |
| Jolpica F1 API | race schedules: names, rounds, dates | CC BY-NC-SA 4.0 | in the docs and the Kometa file | | Jolpica F1 API | race schedules: names, rounds, dates | CC BY-NC-SA 4.0 | in the docs and the Kometa file |
| The circuits' GPS traces and layouts | track outlines, track files | MIT (LICENSE.md) | in the docs | | The circuits' GPS traces and layouts | track outlines, track files | MIT (LICENSE.md) | in the docs |
The national sources' exact credit lines and tile addresses are read from each provider's own pages when IGN's yearly layers cover only the départements flown that year, so a frame near a border falls into a hole;
they are built; the lines above are the form to fill. the 2021–2023 mosaic covers the whole country, and its frozen date range is the date the Etalab licence asks
for. EOX's 2016 mosaic (CC BY 4.0) was rejected by the operator: too soft to read a circuit. (EOX's
capabilities also mark 2017 as CC BY 4.0.)
**The satellite chain.** `bg=satellite` takes, per layout, the first source that has it: the layout's picked **`bg=satellite`** (and `aerial`, kept for addresses already in use) takes, per layout, the national aerial
Commons photo, then the national aerial photo of the circuit's country, then EOxCloudless: the 2016 mosaic for photo of the circuit's country, else EOX's newest mosaic. The operator can switch a layout to the dark
a layout raced in or before 2016 (CC BY 4.0, free of share-alike), else the newest mosaic. `bg=aerial` is the OpenStreetMap map, where EOX is too soft to read the circuit: `"use": "map"` in its entry of
same as `bg=satellite`, kept for addresses already in use. `circuits/photos.json`; a national source still wins, as it is sharper. **`bg=photo`** draws the layout's picked
Commons photo, with the track as an inset; without a picked photo it draws what `bg=satellite` draws for that
layout. No style takes `bg=photo` by default: a photo is not placed on the map, so its crop need not show the
circuit, and the operator judged it unfit as a default.
**Fetching.** Every request carries the app's own User-Agent, `f1-circuits/<version> (+<public address>)`, **Fetching.** Every request carries the app's own User-Agent, `f1-circuits/1.0.0 (+<public address>)`, never a
never a person's address. OpenStreetMap tiles are fetched only when a picture is asked for, at most two at a person's address; Jolpica's included. OpenStreetMap tiles are fetched only when a picture is asked for, never
time, never ahead (its policy forbids pre-seeding). EOX's and the national sources' tiles may be fetched ahead ahead (its policy forbids pre-seeding). At most 2 requests at once go to OpenStreetMap and to IGN, 4 to the
by a tool, paced. Commons: one API request at a time, at most five a second, at most two downloads at once. others. Commons: one API request at a time, at most five a second, at most two downloads at once.
## Layers (kept for good) ## Layers (kept for good)
| Layer | Made from | Key | Class | | Layer | Made from | Key | Class |
|:---|:---|:---|:---| |:---|:---|:---|:---|
| Map picture | the tiles of one source around a layout's trace, at its zoom, for one frame (poster 1000×1500, thumb 1920×1080) | source, source year, trace hash, frame, zoom, render version | `rebuildable` | | Map picture | the tiles of one source around a layout's trace, at its zoom (at most the source's deepest), for one frame (poster 1000×1500, thumb 1920×1080) | source, source year, trace hash, frame, zoom, render version | `rebuildable` |
| Photo picture | one picked Commons file, cropped to the frame | file name, file's SHA-1 from Commons, frame, render version | `rebuildable` | | Photo picture | one picked Commons file, cropped to the frame, untreated | file name, file's SHA-1 from Commons, frame, render version | `rebuildable` |
| World locator | OpenStreetMap tiles at zoom 5 around the circuit, dark | latitude and longitude rounded to 0.01°, render version | `rebuildable` | | World locator | OpenStreetMap tiles at zoom 5 around the circuit, dark | latitude and longitude rounded to 0.01°, render version | `rebuildable` |
| Track outline points | the layout's trace projected for the frame and zoom | trace hash, frame, zoom | `rebuildable` | | Track outline points | the layout's trace projected for the frame and zoom | trace hash, frame, zoom | `rebuildable` |
A map is kept only when every tile came and the tiles are not all one picture (a provider's placeholder). A map is kept only when every tile came and the tiles are not all one picture (a provider's placeholder).
Layers live in the module's directory `layers`, class `rebuildable` (backed up; fetched again if lost). `dark` and `light` are made from the kept OpenStreetMap layer. A layout whose trace is a point or empty is drawn
at the circuit's location, without a track. Layers live in the module's directory `layers`, class `rebuildable`
(backed up; fetched again if lost).
## Finished images (kept, capped) ## Finished images (kept, capped)
Every finished picture is stored under a key made of its route, its options and the keys of the layers it was Every finished picture is stored under a key made of its route, its resolved options and the keys of the layers
made from, in the directory `posters`, class `cache`, at most 2 GB; the least recently used go first when it it was made from, in the directory `posters`, class `cache`, at most 2 GB; the least recently used go first when
is full. A picture whose layer did not arrive is not stored. it is full. A picture whose layer did not arrive is not stored. The render version is `r3`: no poster stored
before it is served again.
**What clients keep.** An address that carries the current render version (`?v=<render version>`, as the **What clients keep.** An address that carries the render version (`?v=r3`, as the Kometa file writes it) is
Kometa file writes it) is sent `Cache-Control: public, max-age=31536000, immutable`. Any other address is sent sent `Cache-Control: public, max-age=31536000, immutable`. Any other address is sent an ETag and
an ETag and `max-age=86400`, and a matching `If-None-Match` gets a 304. A picture served without its layer is `max-age=86400`, and a matching `If-None-Match` (weak or strong) gets a 304. A picture served without its layer
sent `max-age=300` and no ETag. is sent `max-age=300` and no ETag.
## Options ## Options
@@ -76,47 +85,74 @@ option or value is answered 422, naming it.
| Option | Values | Default | Drawn | | Option | Values | Default | Drawn |
|:---|:---|:---|:---| |:---|:---|:---|:---|
| `style` | `classic`, `minimal` | `classic` | a preset of the options below; any option given overrides it | | `style` | `classic`, `minimal` | `classic` | a preset per frame of the options below; any option given overrides it |
| `bg` | `satellite` (alias `aerial`), `osm`, `dark`, `light`, `none` | `satellite` | the kept map or photo layer | | `bg` | `satellite` (alias `aerial`), `photo`, `osm`, `dark`, `light`, `none` | `satellite` | the kept map or photo layer |
| `photo` | `bw`, `duotone`, `natural` | `bw` | the treatment of a photo layer | | `photo` | `bw`, `natural` | `natural` | the treatment of a photo layer, applied when the picture is assembled (`bw`: luminance greyscale) |
| `show` | a comma list of `wordmark`, `round`, `name`, `subtitle`, `date`, `circuit`, `locality`, `session` | the style's | on the fly | | `show` | a comma list of `wordmark`, `round`, `name`, `subtitle`, `date`, `circuit`, `locality`, `session` | the style's | on the fly |
| `locator` | `on`, `off` | `on` | the kept locator layer | | `locator` | `on`, `off` | the style's | the kept locator layer |
| `checker` | `on`, `off` | `on` | on the fly | | `checker` | `on`, `off` | the style's | on the fly |
| `track` | `off`, or a colour `#rrggbb` with an optional width, `#ffffff,6` | white, 6 | on the fly from the kept outline points; an inset over a photo layer | | `track` | `off`, or a colour `#rrggbb` with an optional width 1 to 30, `#ffffff,6` | white, 6 | on the fly from the kept outline points; over a photo, an inset |
| `dim` | 0 to 1 | the style's | on the fly | | `dim` | 0 to 1: the darkening behind the track; the bands behind the texts keep their proportion | the style's | on the fly |
| `accent` | `#rrggbb` | the style's | the wordmark's colour | | `accent` | `#rrggbb` | the style's | the wordmark's colour |
| `width` | 200 up to the frame's own width | the frame's | scaled down at encoding | | `width` | 400 up to the frame's own width | the frame's | scaled down at encoding |
| `format` | `png`, `jpg`, `webp` | `png` | encoding | | `format` | `png`, `jpg`, `webp` | `png` | encoding, with its Content-Type, on the same `.png` addresses |
The credit line is drawn on every picture, at the bottom, at least 12 px high, in every style. **The presets.** `classic` reproduces the earlier look per frame: on a poster checker and locator on, dim 0.43;
on a thumb checker and locator off, dim 0.55; on a season poster dim 0.24. `minimal`: on a poster
`show=name,date`, on a thumb `show=name,session`; checker off, locator off, dim 0.25; accent and track as
`classic`.
**Placement.** `circuit` and `locality`, when asked for, are one grey 28 px line "<circuit> · <locality>" above
the date on a poster, under the subtitle on a thumb. A `date` asked for on a thumb goes under the session label,
grey, 36 px. The track inset over a photo is the trace fitted to 220×220 px (300×300 on a thumb), bottom right
above the date strip, on a 50% black panel. A locator on a thumb sits top right, 220 px, 60 px from the edges.
**Season posters.** `wordmark` is "FORMULA 1", `name` the year, `subtitle` "WORLD CHAMPIONSHIP"; `round`, `date`,
`circuit`, `locality`, `session`, `locator` and `track` are accepted and draw nothing. `bg=none` draws no photo;
any other `bg` draws the season's picked photo, if any.
## Season posters ## Season posters
A season poster shows a season's cars only from a photo picked from Wikimedia Commons' A season poster shows a season's cars only from a photo picked from Wikimedia Commons, credited like any
"<year> Formula One season cars" category, credited like any Commons photo; until one is picked, it is drawn Commons photo; until one is picked, it is drawn without a photo. Photos without a free licence are never used:
without a photo. Photos without a free licence are never used. the operator's earlier, hand-curated season photos carry agency credits (Getty Images, Motorsport Images/LAT
and others) and stay private, as the reference for finding a freely licensed photo of the same car.
## Picking photos ## Picking photos
A tool lists candidates from Commons per layout (aerial photos of the circuit dated in the layout's years) and `tools/commons_candidates.py` lists candidates from Commons per layout (aerial photos of the circuit dated in the
per season (that season's cars): only CC0, public domain, CC BY and CC BY-SA; Commons' quality marks, size and layout's years) and per season (that season's cars): only CC0, public domain, CC BY and CC BY-SA; quality marks,
landscape first. The picker page of the example site shows them with the poster treatment, beside the picks of size and landscape first; written to `examples/data/candidates.json`. The picker page shows, per layout, the
the circuit's other layouts, and gives the chosen entry to copy. Picks are kept in the repository, in `bg=satellite` decision first (the national photo and EOX next to each other; keep the satellite, or use the map
`circuits/photos.json` (layout → file, licence, author, credit, date) and `seasons/photos.json`. instead), then the optional photo candidates for `bg=photo`, beside the picks of the circuit's other layouts; per
season, its candidates beside the nearest seasons' picks. It gives the entry to copy; it writes nothing.
The picks live in the repository. `circuits/photos.json` is keyed by the layout's path under `circuits/`
without extension (`belgium/spa/circuit-de-spa-francorchamps/1983-`), `seasons/photos.json` by the year as text.
An entry holds the photo fields (`file`, the Commons title without "File:"; `licence`; `author`; `credit`;
`date`, `YYYY[-MM[-DD]]`), `"use": "map"`, or both. A key starting with `$` is a note and is skipped. Refused and
logged when read: an unknown `use`, incomplete photo fields, an entry with neither, a licence that is not free.
## Licences, stated ## Licences, stated
- On every picture: the credit line of each source it was made from. - On every picture: the credit line of each source it was made from, joined with " · ", at least 12 px high
- In every picture's response: `X-Credits` with the same line, and `Link: </licences>; rel="license"`. after scaling, wrapping when needed, on a dark band above the bottom strip.
- `/licences`: every source, its licence, its credit and its terms' address, as JSON; the example site's - **A picture's licence follows its sources:** CC BY-SA 4.0 when made from a CC BY-SA photo (2.0, 3.0 and
licences page shows it. 3.0 DE allow a later version with the same elements); CC BY-NC-SA 4.0 when made from EOX's mosaic; CC BY 4.0
- Posters are offered under CC BY-NC-SA 4.0 (they carry Jolpica's data, and may carry EOX's later mosaics and otherwise. Jolpica's race names and dates are single facts and do not set it. The satellite chain takes one
share-alike photos); the track files and the GPS traces under the MIT licence. source, so a BY-SA photo and an NC-SA mosaic never meet on one picture; a picture that would combine them is
refused.
- In every picture's response: `X-Credits` (the credit line folded to ASCII: ß→ss, æ→ae, ø→o, œ→oe, đ→d, then
accents dropped, "©" as "(c)", sources joined with " | "), `X-License`, and `Link: </licences>; rel="license"`;
CORS exposes them and the ETag.
- `/licences`: `pictures` (the rule and its licences), `tracks` (MIT), and every source with its licence, credit,
terms' address and the licence a picture made from it gets; the example site's licences page shows it.
- The Kometa file says in its first lines that its data comes from Jolpica under CC BY-NC-SA 4.0. - The Kometa file says in its first lines that its data comes from Jolpica under CC BY-NC-SA 4.0.
- The unofficial-use disclaimer for the Formula 1 marks is shown at the foot of `/`, `/docs` and the example - The unofficial-use disclaimer for the Formula 1 marks is shown at the foot of `/`, `/docs` and every example
site. page.
## Not in this change ## Not in this change
The disk tile store (replaced by kept layers), renaming the service away from "F1", and the four layouts whose The disk tile store (replaced by kept layers); renaming the service away from "F1"; the four layouts whose trace
trace is empty or a point (traced separately). is empty or a point, and the Bahrain and Donington traces that sit off their real track (traced separately); the
season photos matched to the operator's curated cars.