jschoubben db9f386c7a Add a library page: seasons, race weekends and sessions as Plex shows them
The operator wants to browse the posters the way a Plex or Emby Formula 1
library shows them. The page reads the whole library from the one Kometa
file (rounds, race names in the race posters' addresses, sessions in the
episodes'), waits through a fresh server's minutes-long first answer
instead of failing, and loads each picture only when it is on screen, two
at a time, dropping the queue when the reader leaves a level: every
poster is a render of about 10 s that pulls map tiles. Each level has its
own address and back/forward work; a picture the server has none for is
a plain card with its name.

The session order per weekend format moves into site.js, so the posters
page and the library read the same list.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
2026-11-27 10:33:19 +01:00
2024-01-16 10:17:45 +01:00
2024-02-08 12:38:34 +01:00

F1 Circuits

The circuits that have hosted a Formula 1™ Grand Prix (77 of the 78; Caesars Palace, 1981-82, is missing), traced by GPS layout by layout, and an API that serves them: track maps as GeoJSON, SVG and PNG, and posters and thumbnails for a Formula 1 library in Plex, Emby or Kometa.

The API

Request Answers
GET /circuits every country, with its localities, circuits and layouts
GET /circuits/{country} the country's localities
GET /circuits/{country}/{locality} the locality's circuits
GET /circuits/{country}/{locality}/{circuit} one circuit: its name, Jolpica id, links and layouts
GET /circuits/{country}/{locality}/{circuit}/layout/{layout} one layout and its description
GET /circuits/{country}/{locality}/{circuit}/layout/{layout}/{format} the layout's file: geojson, svg or png
GET /tracks/{country}/{locality}/{circuit}/year/{year}/{format} the layout the circuit used that year
GET /grand-prix/{race}/{season}/{format} the layout a race ran on, such as /grand-prix/Qatar Grand Prix/2025/geojson
GET /posters/race/{race}/{season}.png?bg=… a 1000×1500 race poster; bg is aerial (default), osm, dark, light or none
GET /posters/season/{season}.png a 1000×1500 season poster
GET /posters/session/{race}/{season}/{session}.png a 1920×1080 thumbnail for one session, such as fp1, qualifying, sprint or race
GET /kometa/formula-1-metadata.yml Kometa metadata that sets these posters on a Plex Formula 1 library

A race is named as Jolpica (the Ergast API's successor) names it in its schedule, and its circuit is found by Jolpica's circuit id (ergastId in circuits.json), never by the circuit's name: Jolpica renames circuits (Losail became Lusail), the id stays.

The data

circuits/circuits.json holds country → locality → circuit → layout. A circuit has its name, its Jolpica ergastId, links to Wikipedia and the F1 wiki, and its layouts. A layout is named by the years it was used: 1950- (from 1950 on), 2000-2007, or 2010 (that year only). Each layout's files sit at circuits/<country>/<locality>/<circuit>/<layout> with the extensions .geo.json (the GPS trace, a GeoJSON LineString), .svg and .png.

Country Locality Circuit Jolpica id Layouts (GPS trace)
Argentina Buenos Aires Autodromo Juan y Oscar Gálvez galvez 1953-1960 · 1971-1973 · 1974-1981 · 1995-1998
Australia Adelaide Adelaide Street Circuit adelaide 1985-1995
Australia Melbourne Albert Park Grand Prix Circuit albert_park 1996-2019 · 2021-
Austria Spielberg Red Bull Ring red_bull_ring 1970-1976 · 1977-1987 · 1997-2003 · 2014-
Austria Styria Zeltweg zeltweg 1963-1964
Azerbaijan Baku Baku City Circuit baku 2016-
Bahrain Sakhir Bahrain International Circuit bahrain 2004- · 2010 · 2020
Belgium Brussels Nivelles-Baulers nivelles 1972-1974
Belgium Spa Circuit de Spa-Francorchamps spa 1950-1970 · 1983-
Belgium Zolder Zolder zolder 1973-1984
Brazil Rio de Janeiro Autodromo Internacional Nelson Piquet jacarepagua 1978-1989
Brazil São Paulo Autodromo Jose Carlos Pace interlagos 1972-1980 · 1990-
Canada Montreal Circuit Gilles Villeneuve villeneuve 1978-
Canada Ontario Mosport International Raceway mosport 1967-1977
Canada Quebec Circuit Mont-Tremblant tremblant 1968-1970
China Shanghai Shanghai International Circuit shanghai 2004-
France Clermont-Ferrand Charade Circuit charade 1965-1972
France Dijon Dijon-Prenois dijon 1974-1984
France Le Castellet Circuit Paul Ricard ricard 1971-1985 · 1986-1990 · 2018-
France Le Mans Bugatti Circuit lemans 1965
France Magny Cours Circuit de Nevers Magny-Cours magny_cours 1991-2008
France Reims Reims-Gueux reims 1950-1951 · 1953-1966
France Rouen Rouen-Les-Essarts essarts 1952 · 1957-1968
Germany Berlin AVUS avus 1959
Germany Hockenheim Hockenheimring hockenheimring 1970-
Germany Nurburg Nurburgring nurburgring 1951-
Hungary Budapest Hungaroring hungaroring 1986-1989 · 1989-2002 · 2003-
India Uttar Pradesh Buddh International Circuit buddh 2011-2013
Italy Imola Autodromo Enzo e Dino Ferrari imola 1980-1994 · 1995-2006 · 2020-
Italy Monza Autodromo Nazionale di Monza monza 1950-
Italy Mugello Autodromo Internazionale del Mugello mugello 2020
Italy Pescara Pescara Circuit pescara 1957
Japan Okayama Okayama International Circuit okayama 1994-1995
Japan Oyama Fuji Speedway fuji 1976-1977 · 2007-2008
Japan Suzuka Suzuka Circuit suzuka 1987-
Korea Yeongam County Korean International Circuit yeongam 2010-2013
Malaysia Kuala Lumpur Sepang International Circuit sepang 1999-2017
Mexico Mexico City Autodromo Hermanos Rodriguez rodriguez 1962-1970 · 1986-1992 · 2015-
Monaco Monte-Carlo Circuit de Monaco monaco 1950-1972 · 1973-1975 · 1976-1985 · 1986-1996 · 1997-2002 · 2003-2014 · 2015-
Morocco Casablanca Ain Diab ain-diab 1957-1958
Netherlands Zandvoort Circuit Park Zandvoort zandvoort 1952-1971 · 1972-1985 · 2020-
Portugal Estoril Autódromo do Estoril estoril 1984-1993 · 1994-1996
Portugal Lisbon Monsanto Park Circuit monsanto 1959
Portugal Oporto Circuito da Boavista boavista 1958-1960
Portugal Portimão Autodromo Internacional do Algarve portimao 2020-
Qatar Al Daayen Losail International Circuit losail 2021-
Russia Sochi Sochi Autodrom sochi 2014-
Saudi Arabia Jeddah Jeddah Corniche Circuit jeddah 2021-
Singapore Marina Bay Marina Bay Street Circuit marina_bay 2008-2022 · 2023-
South Africa Eastern Cape Province Prince George Circuit george 1960-1966
South Africa Midrand Kyalami kyalami 1967-1985 · 1992-1993
Spain Barcelona Circuit de Pedralbes pedralbes 1951-1954
Spain Barcelona Montjuïc montjuic 1969-1975
Spain Jerez de la Frontera Circuito de Jerez jerez 1986-1990 · 1994-1997
Spain Madrid Jarama jarama 1967-1981
Spain Madrid Madring madring 2026-
Spain Montmelo Circuit de Barcelona-Catalunya catalunya 1991-1993 · 1994 · 1995-2003 · 2004-2006 · 2007-2020 · 2021-
Spain Valencia Valencia Street Circuit valencia 2008-2012
Sweden Anderstorp Scandinavian Raceway anderstorp 1973-1977 · 1978
Switzerland Bern Circuit Bremgarten bremgarten 1950-1954
Turkey Istanbul Istanbul Park istanbul 2005-
UK Castle Donington Donington Park donington 1993
UK Kent Brands Hatch brands_hatch 1964-1974 · 1976-1986
UK Liverpool Aintree aintree 1955-1962
UK Silverstone Silverstone Circuit silverstone 1950-
USA Austin Circuit of the Americas americas 2012-
USA California Long Beach long_beach 1976-1981 · 1982 · 1983
USA California Riverside International Raceway riverside 1960
USA Dallas Fair Park dallas 1984
USA Detroit Detroit Street Circuit detroit 1982-1988
USA Florida Sebring International Raceway sebring 1959
USA Indianapolis Indianapolis Motor Speedway indianapolis 2000-2007 · 1950-1960
USA Miami Miami International Autodrome miami 2022-
USA Nevada Las Vegas Street Circuit vegas 2023-
USA New York State Watkins Glen watkins_glen 1961-1980
USA Phoenix Phoenix street circuit phoenix 1989-1990 · 1991
United Arab Emirates Abu Dhabi Yas Marina Circuit yas_marina 2009-

The upstream data this repository started from is kept as it was: f1-circuits.geo.json (every circuit in one GeoJSON file), f1-locations.geo.json (one point per circuit) and f1-locations.json.

Logs

The service writes one line per request: the visitor's address (from the proxy's X-Forwarded-For), the request, its status, size and duration, the referrer and the user agent. Race schedules come from Jolpica, paced under its rate limit and kept in cache/jolpica/; a throttled or failed fetch is said in the log and never kept.

Caching

Everything the service fetches or renders is kept in cache/ (the module's cache volume): race schedules from Jolpica in cache/jolpica/ (a season that is over for good, the running one for six hours), map tiles in cache/tiles/ (30 days), and every poster and thumbnail in cache/posters/ once it rendered whole. A poster is sent with an ETag and a day's Cache-Control; one whose map or photo failed is not kept, and is sent with five minutes', so it is rendered again once its source answers.

Checks

merge-check.sh runs before a change merges: every Python file the service ships must parse, and the tests in tests/ must pass (every circuit has one unique ergastId, a race resolves by it, a failed Jolpica fetch is never kept, every link in this README leads to a file).

Acknowledgment

Disclaimer

This repository 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 trademarks of Formula One Licensing B.V.

Formula 1™ circuits data are not official, and they are not approved nor endorsed by Formula One Licensing B.V.

License

The MIT License (MIT) - Copyright (c) 2019-2024 Tomislav Bacinger

S
Description
F1 circuit layouts with year-by-year SVGs — manually traced track variations
Readme
833 MiB
Languages
Python 98.6%
Shell 0.7%
Dockerfile 0.7%