diff --git a/examples/builder.html b/examples/builder.html new file mode 100644 index 0000000..27e99ff --- /dev/null +++ b/examples/builder.html @@ -0,0 +1,360 @@ + + + + + + Poster builder · F1 Circuits API examples + + + + + +
+ F1 Circuits API + +
+
+ +
+

Poster builder

+

+ Every poster route takes the same options as query parameters. Tick an option to send it; an option left out takes + its default. The address below follows every change, and the picture is rendered only when you press the button, + because the server draws it and may fetch map tiles first. +

+ +
+

1. Which picture

+
+ +
+
+
+ + +
+
+
+
+ +
+

2. The options

+

An unknown option or value is answered 422, naming it. The credit line is drawn on every picture + whatever the options; no option takes it off.

+
+
+ +
+

3. The picture

+
+ +
+
+
Not rendered yet.
+
+
+
+
+ + + + + + + + diff --git a/examples/circuits.html b/examples/circuits.html index ae465d7..68f31c5 100644 --- a/examples/circuits.html +++ b/examples/circuits.html @@ -18,8 +18,11 @@ GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -89,6 +92,13 @@ All examples + diff --git a/examples/licences.html b/examples/licences.html new file mode 100644 index 0000000..caee185 --- /dev/null +++ b/examples/licences.html @@ -0,0 +1,176 @@ + + + + + + Licences · F1 Circuits API examples + + + + + +
+ F1 Circuits API + +
+
+ +
+

Licences

+

+ Every picture the API makes is drawn from sources whose licences allow keeping a copy, and each says where it comes + from: the credit of every source it was made from is drawn at its foot, sent in its X-Credits header, + and listed here. A picture’s licence follows its sources, and is sent in its X-License header. Its + Link: </licences>; rel="license" header points to this list. +

+ +
+

The sources

+

What /licences answers, as a table. A credit with <author> and + <licence> is filled in with the photo’s own; one with <year> with the mosaic’s + year. The last column is the licence a picture made from that source gets.

+
+
+
+
The answer as it came
+
+ +
+

What the API offers, and under which licence

+
+

A race name and its date on a picture are single facts: they do not set its licence. The Kometa + file says in its first lines that its race schedules come from Jolpica, under CC BY-NC-SA 4.0.

+
+ +
+

Formula 1

+

This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE, + FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One + Licensing B.V.

+
+
+ + + + + + + + diff --git a/examples/map.html b/examples/map.html index 9bf9bb5..10c046e 100644 --- a/examples/map.html +++ b/examples/map.html @@ -20,8 +20,11 @@ GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -32,7 +35,7 @@ Each layout was traced by GPS along the track. Its geojson format is that trace: a GeoJSON FeatureCollection holding one LineString of [longitude, latitude] points. Any map library draws it as it comes; this page uses Leaflet. Switch to the - satellite layer to see the trace follow the tarmac. + satellite layer (EOxCloudless, Sentinel-2 at 10 m) to see the trace over the ground.

@@ -65,6 +68,13 @@ All examples + @@ -88,13 +98,18 @@ maxZoom: 19, attribution: '© OpenStreetMap contributors', }).addTo(map); - const satellite = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { + // EOxCloudless, the newest Sentinel-2 mosaic (10 m): the satellite source the posters use where no photo or national + // aerial photo exists (docs/posters.md). Tiles past zoom 15 are the same pixels, so Leaflet scales them up. + const satellite = L.tileLayer('https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2025_3857/default/g/{z}/{y}/{x}.jpg', { maxZoom: 19, - maxNativeZoom: 18, - attribution: 'Imagery © Esri, Maxar, Earthstar Geographics', + maxNativeZoom: 15, + attribution: 'EOxCloudless https://cloudless.eox.at by EOX IT Services GmbH' + + ' (Contains modified Copernicus Sentinel data 2025),' + + ' CC BY-NC-SA 4.0', }); - L.control.layers({ 'OpenStreetMap': osm, 'Satellite (Esri)': satellite }).addTo(map); - L.control.scale({ imperial: false }).addTo(map); + L.control.layers({ 'OpenStreetMap': osm, 'Satellite (EOxCloudless 2025)': satellite }).addTo(map); + // Top left: EOxCloudless's credit runs over two lines at the foot, where it would cover the scale. + L.control.scale({ imperial: false, position: 'topleft' }).addTo(map); map.on('focus', () => map.scrollWheelZoom.enable()); map.on('blur', () => map.scrollWheelZoom.disable()); diff --git a/examples/picker.html b/examples/picker.html new file mode 100644 index 0000000..2aafff0 --- /dev/null +++ b/examples/picker.html @@ -0,0 +1,763 @@ + + + + + + Photo picker · F1 Circuits API examples + + + + + + +
+ F1 Circuits API + +
+
+ + + + +
+

Photo picker

+

+ Per layout, the main choice is what bg=satellite 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 + bg=photo, which falls back to what bg=satellite draws while none is picked; a season poster + shows that season’s cars only from a picked photo. The photos are the candidates + tools/commons_candidates.py found, cropped to the poster’s frame as the service crops them, in natural + 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. +

+

+ Only CC0, public domain, CC BY and CC BY-SA files are listed, with Commons’ quality marks first, then size, then + landscape. A search also finds ground photos, maps and the odd helicopter, so look at each one before you pick it. +

+ +
+

1. The lists

+

The candidates come with the site; the picks are read from the repository, beside the page’s folder. + Run python3 -m http.server in the working copy and open /examples/picker.html there to + have both, or load a picks file from disk below.

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+

2. What to pick for

+
+ + + +
+
+ +
+
+
+
+ + + +
+ +
+

Picks of the circuit’s other layouts

+
+

Candidates

+
+
+
+ + + + + + + + + diff --git a/examples/posters.html b/examples/posters.html index ba1de26..20f7282 100644 --- a/examples/posters.html +++ b/examples/posters.html @@ -18,8 +18,11 @@ GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -44,14 +47,15 @@

Race poster

-

/posters/race/{race name}/{season}.png?bg={background}, 1000×1500: the round, the race’s name, the track and its date over a map of the circuit.

+

/posters/race/{race name}/{season}.png?bg={background}, 1000×1500: the round, the race’s name, the track and its date over a map of the circuit. Every other option is on the poster builder.

@@ -101,7 +105,14 @@ +
+

This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE, + FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One + Licensing B.V.

+

Licences and credits: every source the pictures are made from, the licence each + picture takes from its sources, and the licence of the track files and the GPS traces (MIT).

diff --git a/examples/site.css b/examples/site.css index f246bc0..a5f8b7d 100644 --- a/examples/site.css +++ b/examples/site.css @@ -44,6 +44,9 @@ * { box-sizing: border-box; } +/* An element hidden by the page stays hidden, whatever display its class gives it. */ +[hidden] { display: none !important; } + body { margin: 0; background: var(--bg); @@ -353,3 +356,92 @@ a.tile-link:hover .tile-frame { outline: 3px solid var(--accent); } @media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } } .waiting { display: flex; gap: 1rem; align-items: center; } .waiting p { margin: 0.2rem 0; } + +/* ---- the Formula 1 disclaimer, at the foot of every page ---- */ + +footer.disclaimer { + max-width: 1200px; + margin: 0 auto; + padding: 0 1.5rem 2.5rem; + font-size: 0.78rem; + color: var(--muted); +} +footer.disclaimer p { margin: 0.3rem 0; max-width: 60rem; } + +/* ---- segmented toggles (picker, builder) ---- */ + +.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; } +.seg button { border: none; border-radius: 0; border-right: 1px solid var(--line); } +.seg button:last-child { border-right: none; } +.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); } + +/* ---- photo picker ---- */ + +.photos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } +.photos.thumb { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } +.photo-card { + border: 1px solid var(--line); + border-radius: var(--radius); + padding: 0.5rem; + display: flex; + flex-direction: column; + gap: 0.35rem; + min-width: 0; + background: var(--card); +} +.photo-card.chosen { outline: 3px solid var(--accent); } +.photo-card.picked { border-color: var(--ok); border-width: 2px; } +.photo-frame { background: #000; border-radius: 6px; overflow: hidden; aspect-ratio: 2 / 3; } +.photos.thumb .photo-frame { aspect-ratio: 16 / 9; } +.photo-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; } +.treat-bw .photo-frame img { filter: url(#bw); } +.photo-card .name { font-weight: 650; font-size: 0.85rem; line-height: 1.3; overflow-wrap: anywhere; } +.photo-card .meta { font-size: 0.78rem; color: var(--muted); line-height: 1.4; } +.photo-card .meta b { color: var(--text); font-weight: 600; } +.photo-card .tags { display: flex; flex-wrap: wrap; gap: 0.25rem; } +.tag { font-size: 0.7rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.45rem; color: var(--muted); } +.tag.mark { border-color: var(--ok); color: var(--ok); } +.tag.warn { border-color: var(--warn); color: var(--warn); } +.photo-card .actions { display: flex; gap: 0.5rem; align-items: center; margin-top: auto; font-size: 0.8rem; } +.photo-card .actions button { font-size: 0.8rem; padding: 0.2rem 0.6rem; } +.photos.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } + +.copy-block { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.6rem 0; } +.copy-block .head { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; } +.copy-block .head span { font-size: 0.85rem; color: var(--muted); } + +/* ---- poster builder ---- */ + +.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem 1.25rem; } +.option { border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; display: flex; flex-direction: column; gap: 0.35rem; } +.option .opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; } +.option .opt-head code { font-weight: 700; } +.option .opt-head small { color: var(--muted); font-size: 0.75rem; text-align: right; } +.option .opt-body { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; align-items: center; font-size: 0.88rem; } +.option .opt-body label { display: inline-flex; align-items: center; gap: 0.3rem; } +.option.set { border-color: var(--accent); } +.option select { max-width: 100%; min-width: 0; } +.option .opt-body > select { flex: 1; } +.option input[type="color"] { padding: 0.1rem; width: 3rem; height: 2rem; } +.option input[type="range"] { flex: 1; min-width: 8rem; } +.credits { margin-top: 0.75rem; } +.credits table th { width: 9rem; } +.credits td code { white-space: normal; overflow-wrap: anywhere; } +details.result-raw { margin-top: 0.75rem; } +details.result-raw summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; margin-bottom: 0.5rem; } +table.sources td code { white-space: normal; overflow-wrap: anywhere; } +table.sources th:nth-child(3), table.sources td:nth-child(3) { min-width: 9rem; } +table.sources th:nth-child(4), table.sources td:nth-child(4) { width: 34%; } +.card > div + p.hint { margin-top: 0.75rem; } + +/* ---- the picker's satellite frames ---- */ + +.map-frame { position: relative; background: #111; border-radius: 6px; overflow: hidden; aspect-ratio: 2 / 3; } +.photos.thumb .map-frame { aspect-ratio: 16 / 9; } +.map-frame .map-box { position: absolute; inset: 0; } +.map-frame img { width: 100%; height: 100%; object-fit: cover; display: block; } +.map-frame.plain { display: grid; place-items: center; padding: 0.75rem; text-align: center; color: #c8c8d2; background: #1d1d24; font-size: 0.82rem; } +.photo-card .request.compact { padding: 0.25rem 0.35rem; min-height: 0; gap: 0.3rem; } +.photo-card .request.compact .url { font-size: 0.66rem; } +.photo-card .status { font-size: 0.75rem; margin: 0; } +#sat .choices { margin: 0.75rem 0 0.25rem; } diff --git a/examples/site.js b/examples/site.js index 7182355..9a98990 100644 --- a/examples/site.js +++ b/examples/site.js @@ -182,7 +182,7 @@ return null; } setStatus(statusEl, 'ok', summary); - return { status: res.status, type, blob, ms, size: blob.size, url }; + return { status: res.status, type, blob, ms, size: blob.size, url, headers: res.headers }; } /** Fetches JSON for a card and shows it in its `.result`; returns the parsed value or null. */ @@ -243,10 +243,13 @@ return pre; } - /** What the first bytes of a body are: 'png', 'svg', 'json' or 'unknown'. */ + /** What the first bytes of a body are: 'png', 'jpg', 'webp', 'svg', 'json' or 'unknown'. */ async function sniff(blob) { const head = new Uint8Array(await blob.slice(0, 256).arrayBuffer()); if (head[0] === 0x89 && head[1] === 0x50 && head[2] === 0x4e && head[3] === 0x47) return 'png'; + if (head[0] === 0xff && head[1] === 0xd8 && head[2] === 0xff) return 'jpg'; + const ascii = (from, to) => String.fromCharCode(...head.slice(from, to)); + if (ascii(0, 4) === 'RIFF' && ascii(8, 12) === 'WEBP') return 'webp'; const text = new TextDecoder().decode(head).trimStart(); if (text.startsWith('GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -80,6 +83,13 @@ All examples +
+

This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE, + FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One + Licensing B.V.

+

Licences and credits: every source the pictures are made from, the licence each + picture takes from its sources, and the licence of the track files and the GPS traces (MIT).

+