Files
f1-circuits/docs/posters.md
T
jschoubben f6b9f937d0 Write the lead's answers on the season photos into the design
The season photos are matched to the operator's curated cars (77 seasons, 1950-2026), and the
picks raised questions the design did not answer. The lead's answers of 2026-11-30:

- Season posters: each season's photo is matched to the curated car of that season, in order the
  same car, the same model in a livery it raced that season, the same team's car of that season,
  that season's champion car; a curated photo of another year's car gives way to that season's
  car; the table of picks, seasons/picks.md, names the match per season.
- Picking photos: tools/commons_candidates.py lists a season's candidates from its "<year>
  Formula One season cars" category; where that category holds no free photo of the curated car,
  the person or session picking searches Commons for that car by name, and the pick's row in
  seasons/picks.md says so (no part runs the search: every season is picked).
- An entry's date is when the photo was taken. Where the date Commons gives cannot be (a scan, an
  upload, a camera clock never set, a date after the file's upload), the date its description or
  category gives, marked "date_from"; where neither says, the month of the file's upload, the
  latest it can have been taken, marked "upload" (a true bound, not a date nobody measured).
- The ported CC BY-SA licences (2.0 de, 3.0 de, 3.0 nl) are free like their unported versions and
  give the picture CC BY-SA 4.0; the licences list names them, and 2.5 beside 2.0 and 3.0 (it
  also allows a later version with the same elements).
- Finished images: a finished picture's key also names the credit of each layer drawn from a
  pick, so a pick's changed credit makes a new key (principle 2: a changed input makes a new key).
- What clients keep: the address carries an address version of its own (?v=), separate from the
  render version that keys kept layers and finished pictures; raised when a look changes, so
  clients load it again from the pictures already kept. Raised now to a1 because every season
  poster changed; the render version stays r3.

The season photos leave "Not in this change".

Claude-Session: https://claude.ai/code/session_01JG73KFhbaNj3tyJ8tKmE3W
2026-11-30 11:33:50 +01:00

190 lines
15 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Posters: sources, layers, options and credits
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
caller has, and how every image says where it comes from. Decided with the operator on 2026-11-27, after
reading each source's own terms; the lead's answers to the builders' questions are written in where they
belong.
## Principles
1. **Every source is used only as its terms allow, and says so.** The credit each source asks for is drawn on
every image made from it, sent in a header, and listed on the licences page. A caller cannot switch it off.
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.
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, 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
arrive is served without it, for five minutes, and not kept.
## Sources
Only sources whose licence allows keeping a copy for good are used. Esri, Bing, Azure Maps, Google, Mapbox and
MapTiler are not: their terms forbid automated fetching, keeping, or serving images made from their maps to the
public.
| Source | Used for | Licence | Credit drawn on the image |
|:---|:---|:---|:---|
| USGS imagery (USGSImageryOnly, to zoom 16), United States | `bg=satellite` for circuits in the US | public domain | `USDA, USGS The National Map: Orthoimagery` |
| 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` |
| IGN, the frozen mosaic ORTHOIMAGERY.ORTHOPHOTOS2021-2023, France | `bg=satellite` for circuits in France | Licence Ouverte (Etalab) 2.0 | `© IGN – BD ORTHO, 2021–2023` |
| 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)` |
| 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` |
| 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 |
| The circuits' GPS traces and layouts | track outlines, track files | MIT (LICENSE.md) | in the docs |
IGN's yearly layers cover only the départements flown that year, so a frame near a border falls into a hole;
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 traces follow upstream.** A layout's trace is upstream's (bacinger/f1-circuits) newest trace of that
circuit, copied once into the repository word for word, never fetched at run time. A newer upstream trace of a
circuit already drawn is taken as a plain update.
**`bg=satellite`** (and `aerial`, kept for addresses already in use) takes, per layout, the national aerial
photo of the circuit's country, else EOX's newest mosaic. The operator can switch a layout to the dark
OpenStreetMap map, where EOX is too soft to read the circuit: `"use": "map"` in its entry of
`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/1.0.0 (+<public address>)`, never a
person's address; Jolpica's included. OpenStreetMap tiles are fetched only when a picture is asked for, never
ahead (its policy forbids pre-seeding). At most 2 requests at once go to OpenStreetMap and to IGN, 4 to the
others. Commons: one API request at a time, at most five a second, at most two downloads at once.
## Layers (kept for good)
| Layer | Made from | Key | Class |
|:---|:---|:---|:---|
| 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, 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` |
| 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).
`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; no current race may draw one, which the merge check holds: every
layout that `find_layout_slug_for_year` chooses for a season from 2020 on has a LineString trace of more than 10
points (`tests/test_traces.py`). Layers live in the module's directory `layers`, class `rebuildable`
(backed up; fetched again if lost).
## Finished images (kept, capped)
Every finished picture is stored under a key made of its route, its resolved options, the keys of the layers it was
made from, and the credit of each layer drawn from a pick, in the directory `posters`, class `cache`, at most 2 GB;
the least recently used go first when 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.** The address clients are given carries an address version of its own (`?v=a1`, as the
Kometa file writes it), separate from the render version that keys kept layers and finished pictures. The address
version is raised when a look changes, so clients load it again from the pictures already kept; the render version
is raised only when the drawing itself changes. The address version was raised to `a1` (from `r3`, the render
version the addresses carried before) because every season poster changed; the render version stays `r3`.
An address that carries the address version is sent `Cache-Control: public, max-age=31536000, immutable`. Any
other address is sent an ETag and `max-age=86400`, and a matching `If-None-Match` (weak or strong) gets a 304. A
picture served without its layer is sent `max-age=300` and no ETag.
## Options
Query parameters, the same on `/posters/race/…`, `/posters/season/…` and `/posters/session/…`. An unknown
option or value is answered 422, naming it.
| Option | Values | Default | Drawn |
|:---|:---|:---|:---|
| `style` | `classic`, `minimal` | `classic` | a preset per frame of the options below; any option given overrides it |
| `bg` | `satellite` (alias `aerial`), `photo`, `osm`, `dark`, `light`, `none` | `satellite` | the kept map or 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 |
| `locator` | `on`, `off` | the style's | the kept locator layer |
| `checker` | `on`, `off` | the style's | on the fly |
| `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 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 |
| `width` | 400 up to the frame's own width | the frame's | scaled down at encoding |
| `format` | `png`, `jpg`, `webp` | `png` | encoding, with its Content-Type, on the same `.png` addresses |
**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
A season poster shows a season's cars only from a photo picked from Wikimedia Commons, credited like any
Commons photo; until one is picked, it is drawn 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.
**Each season's photo is matched to the operator's curated car of that season**, in this order: the same car; the
same model in a livery it raced that season; the same team's car of that season; that season's champion car. A
curated photo of another year's car gives way to that season's car. The table of picks, `seasons/picks.md`, names
the match per season.
## Picking photos
`tools/commons_candidates.py` lists candidates from Commons per layout (aerial photos of the circuit dated in the
layout's years) and per season (the photos in its "<year> Formula One season cars" category): only CC0, public
domain, CC BY and CC BY-SA; quality marks, size and landscape first; written to `examples/data/candidates.json`.
Where a season's category holds no free photo of the curated car, the person or session picking searches Commons for
that car by name, and the pick's row in `seasons/picks.md` says so. The picker page shows, per layout, the
`bg=satellite` decision first (the national photo and EOX next to each other; keep the satellite, or use the map
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.
An entry's `date` is when the photo was taken. Where the date Commons gives cannot be when the photo was taken (a
scan, an upload, a camera clock that was never set, a date after the file's upload), it is the date the file's
description or category gives, and the entry is marked `"date_from"`: `"description"` or `"category"`. Where neither
says when the photo was taken, it is the month of the file's upload, the latest it can have been taken, marked
`"date_from": "upload"`. The ported CC BY-SA licences (2.0 de, 3.0 de, 3.0 nl) are free like their unported versions
and give the picture CC BY-SA 4.0.
The API serves both files, read-only, as the poster service has them loaded: `/picks/circuits.json` and
`/picks/seasons.json` answer the notes first, then the entries it draws from (a refused entry is left out), with the
CORS of every route and, like the other JSON routes, no `Cache-Control`; the root route lists both. The picker reads the picks
there first, from the API its site picks. Only a page opened from a working copy (from disk, or on a loopback host:
`localhost`, `127.0.0.1`, `[::1]`) falls back to the repository's files when the API does not answer them; anywhere
else a failure says which address failed and why.
## Licences, stated
- On every picture: the credit line of each source it was made from, joined with " · ", at least 12 px high
after scaling, wrapping when needed, on a dark band above the bottom strip.
- **A picture's licence follows its sources:** CC BY-SA 4.0 when made from a CC BY-SA photo (2.0, 2.5, 3.0
and the ported 2.0 DE, 3.0 DE and 3.0 NL allow a later version with the same elements); CC BY-NC-SA 4.0 when made
from EOX's mosaic; CC BY 4.0 otherwise. Jolpica's race names and dates are single facts and do not set it. The
satellite chain takes one 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 unofficial-use disclaimer for the Formula 1 marks is shown at the foot of `/`, `/docs` and every example
page.
## Not in this change
The disk tile store (replaced by kept layers); renaming the service away from "F1"; the three layouts whose trace
is empty (Mont-Tremblant 1968-1970, Buddh 2011-2013, Yeongam 2010-2013), Bahrain's trace that sits off its real
track, and Donington's, a copy of Aintree's trace (traced separately).