Files
f1-circuits/examples/index.html
T
jschoubben 49a2ebcf15 Add the photo picker, poster builder and licences pages
A pick is a repository edit, so the picker shows the Commons candidates cropped to the poster's
frame, natural or bw as the service treats them, beside the picks of the circuit's other
layouts, and gives the entry to copy (the picks file's "$comment" kept first). The builder sends
every option of docs/posters.md as a query parameter, renders only on request and shows the
answer's X-Credits and X-License. The licences page shows /licences: each source, its credit and
the licence a picture made from it gets.

Every page now carries the Formula 1 disclaimer at its foot, as F1's guidelines ask of an
unofficial site, and the posters page lists the backgrounds the design keeps (no Esri).

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
2026-11-27 15:04:38 +01:00

178 lines
8.4 KiB
HTML
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.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>F1 Circuits API · examples</title>
<meta name="description" content="Worked examples of every route of the F1 Circuits API: circuits, track images, GPS traces, grand prix lookup, posters and Kometa metadata.">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="site.css">
</head>
<body>
<header class="site">
<a class="brand" href="index.html">F1 <span>Circuits</span> API</a>
<nav aria-label="Examples">
<a href="index.html" aria-current="page">Overview</a>
<a href="circuits.html">Circuit browser</a>
<a href="tracks.html">Track images</a>
<a href="map.html">GPS traces</a>
<a href="grand-prix.html">Grand prix lookup</a>
<a href="posters.html">Posters</a>
<a href="builder.html">Poster builder</a>
<a href="kometa.html">Kometa</a>
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html">Licences</a>
</nav>
<div id="api-base"></div>
</header>
<main>
<h1>The F1 Circuits API, by example</h1>
<p class="lead">
F1 Circuits serves the layout of every Formula 1 circuit, one per period the track was raced in, traced by GPS:
as an SVG drawing, a PNG image and the GeoJSON trace itself. On top of the layouts it renders race and season
posters, session thumbnails and a Kometa metadata file for a Formula 1 library in Plex.
</p>
<p>
The public address is <a href="https://f1-circuits.zurag.be/">https://f1-circuits.zurag.be</a>. Every route is a
plain <code>GET</code>, needs no key, and allows any origin (CORS), so a page anywhere can call it from the browser.
Each page below makes real calls and shows the exact URL it sends next to the answer: copy it into a terminal
(<code>curl -O &lt;url&gt;</code>) or a page of your own.
</p>
<h2>The examples</h2>
<div class="pages">
<a class="page" href="circuits.html">
<h3>Circuit browser</h3>
<p>Walk the catalogue: countries, their cities, the circuits there and each circuit’s layouts, with every layout’s track image.</p>
<ul>
<li><code>/circuits</code></li>
<li><code>/circuits/{country}</code></li>
<li><code>/circuits/{country}/{city}</code></li>
<li><code>/circuits/{country}/{city}/{circuit}</code></li>
<li><code>/circuits/{country}/{city}/{circuit}/layout/{layout}</code></li>
</ul>
</a>
<a class="page" href="tracks.html">
<h3>Track images</h3>
<p>One layout’s file in SVG, PNG or GeoJSON, chosen by its layout or by a year the circuit was raced.</p>
<ul>
<li><code>/circuits/{country}/{city}/{circuit}/layout/{layout}/{format}</code></li>
<li><code>/tracks/{country}/{city}/{circuit}/year/{year}/{format}</code></li>
</ul>
</a>
<a class="page" href="map.html">
<h3>GPS traces on a map</h3>
<p>Draw a layout’s GeoJSON trace on an OpenStreetMap or satellite map, with its length and start point.</p>
<ul>
<li><code>/circuits/{country}/{city}/{circuit}/layout/{layout}/geojson</code></li>
</ul>
</a>
<a class="page" href="grand-prix.html">
<h3>Grand prix lookup</h3>
<p>Name a race and a season; the API finds the circuit and the layout raced that year.</p>
<ul>
<li><code>/grand-prix/{race name}/{season}/{format}</code></li>
</ul>
</a>
<a class="page" href="posters.html">
<h3>Posters</h3>
<p>Race posters on five backgrounds, season posters and a thumbnail per session of a race weekend, rendered on request.</p>
<ul>
<li><code>/posters/race/{race name}/{season}.png?bg={satellite|osm|dark|light|none}</code></li>
<li><code>/posters/season/{season}.png</code></li>
<li><code>/posters/session/{race name}/{season}/{session}.png</code></li>
</ul>
</a>
<a class="page" href="builder.html">
<h3>Poster builder</h3>
<p>Every option of the poster routes as a control: style, background, photo, texts, locator, track, colours, size and format. Render on demand and read the credits the answer carries.</p>
<ul>
<li><code>/posters/{race|season|session}/….png?style=…&amp;bg=…&amp;photo=…&amp;show=…</code></li>
</ul>
</a>
<a class="page" href="kometa.html">
<h3>Kometa metadata</h3>
<p>The metadata file that gives a Plex Formula 1 library every poster and thumbnail above, and how Kometa uses it.</p>
<ul>
<li><code>/kometa/formula-1-metadata.yml</code></li>
</ul>
</a>
<a class="page" href="library.html">
<h3>Library</h3>
<p>Browse a Formula 1 library as Plex or Emby shows it: seasons, race weekends and sessions, from the Kometa file and the posters.</p>
<ul>
<li><code>/kometa/formula-1-metadata.yml</code></li>
<li><code>/posters/season/{season}.png</code></li>
<li><code>/posters/race/{race name}/{season}.png</code></li>
<li><code>/posters/session/{race name}/{season}/{session}.png</code></li>
</ul>
</a>
<a class="page" href="picker.html">
<h3>Photo picker</h3>
<p>Choose a freely licensed Wikimedia Commons photo per circuit layout and per season, seen as the poster crops it, and copy its entry for the picks file.</p>
<ul>
<li><code>examples/data/candidates.json</code></li>
<li><code>circuits/photos.json</code>, <code>seasons/photos.json</code></li>
</ul>
</a>
<a class="page" href="licences.html">
<h3>Licences</h3>
<p>Every source the pictures are made from, its licence and the credit drawn on every picture; the licence each picture takes from its sources, and that of the track files and the GPS traces.</p>
<ul>
<li><code>/licences</code></li>
</ul>
</a>
</div>
<h2>Choosing which API a page calls</h2>
<div class="card">
<p>
One helper (<a href="site.js"><code>site.js</code></a>) picks the address for every page, in this order:
</p>
<ol>
<li><code>?api=&lt;base&gt;</code> in the page’s address wins, such as <code>?api=http://127.0.0.1:8000</code>. Links between the pages keep it.</li>
<li>A page opened from disk (<code>file://</code>) calls the public service, <code>https://f1-circuits.zurag.be</code>.</li>
<li>A page served over http(s), as the API serves these pages at <code>/examples/</code>, calls its own origin with relative URLs.</li>
</ol>
<p>The address in use is in the header, top right; open it to change it.</p>
</div>
<h2>The API’s own index</h2>
<p>The root route lists the routes and where these examples live.</p>
<div class="card" id="root-call">
<div class="request"></div>
<div class="status"></div>
<div class="result"></div>
</div>
<h2>Words used here</h2>
<table class="kv">
<tr><th>Country, city, circuit</th><td>Slugs in lower case with hyphens, as the <code>/circuits</code> routes list them (<code>belgium</code>, <code>spa</code>, <code>circuit-de-spa-francorchamps</code>). A slug may hold accented letters; encode it in a URL.</td></tr>
<tr><th>Layout</th><td>One shape of a circuit, named by the years it was raced: <code>1950-1970</code>, <code>1983-</code> (1983 until today), or a single year.</td></tr>
<tr><th>Format</th><td><code>svg</code>, <code>png</code> or <code>geojson</code>.</td></tr>
<tr><th>Race name</th><td>The race’s name exactly as <a href="https://api.jolpi.ca/ergast/f1/2024.json">Jolpica</a> (the Ergast successor) writes it, such as <code>Belgian Grand Prix</code>; the API reads the season’s schedule there.</td></tr>
</table>
</main>
<footer class="pager">
<span></span>
<a class="home" href="index.html">All examples</a>
<a rel="next" href="circuits.html">Circuit browser →</a>
</footer>
<footer class="disclaimer">
<p>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.</p>
<p><a href="licences.html">Licences and credits</a>: 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).</p>
</footer>
<script src="site.js"></script>
<script>
F1.callJSON(document.getElementById('root-call'), F1.api('/'));
</script>
</body>
</html>