The circuit and track routes walked circuits.json with chained lookups, so an unknown country, locality, circuit or layout, or a year no layout covers, raised and answered 500 (/circuits/photos.json among them). One lookup now names the first unknown part and the API answers it 404. numpy loads only where a script uses it, so the models, and this lookup's test, need the standard library alone. Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
22 KiB
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: https://f1-circuits.zurag.be (OpenAPI docs)
- The example site: https://f1-circuits.zurag.be/examples/ (its pages are in examples/), one page per feature, each showing the request it makes
- The data: circuits/circuits.json and one folder per circuit under circuits/ — 77 circuits, 122 layouts
How posters are made (sources and their licences, kept layers, options, credits): docs/posters.md.
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?… |
a 1000×1500 race poster: the round, the race's name and date and its track over a picture of its circuit |
GET /posters/season/{season}.png?… |
a 1000×1500 season poster: the year over a picked photo of that season's cars, or over black |
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 |
GET /licences |
every source a picture may be made from: its licence, its credit and its terms, and how a picture's licence follows from them |
The three picture routes take the same options as query parameters (docs/posters.md lists
them): style (classic, minimal), bg (satellite, its alias aerial, osm, dark, light, none),
photo (natural, bw), show (a comma list of wordmark, round, name, subtitle, date, circuit,
locality, session), locator and checker (on, off), track (off, or a colour with an optional width,
#ffffff,6), dim (0 to 1), accent (a colour), width (200 up to the picture's own) and format (png, jpg,
webp). An unknown option or value is answered 422, naming it. bg=satellite takes the layout's picked Wikimedia
Commons photo, else the national aerial photo (USGS in the United States, PDOK in the Netherlands, IGN in France),
else EOxCloudless; circuits/photos.json holds the picks, and {"use": "map"} there makes a
layout draw the dark map instead of EOxCloudless. Every picture carries the credit line of its sources at its
bottom and in X-Credits, its licence in X-License (it follows its sources), and Link: </licences>; rel="license".
An unknown country, locality, circuit or layout, or a year no layout of the circuit covers, is answered 404, naming it.
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 |
1967 |
| 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- |
| 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
Race schedules from Jolpica are kept in cache/jolpica/ (a season that is over for good, the running one for six
hours). What a picture needs from the network is a layer, kept for good in layers/ (the module's layers directory,
backed up and fetched again if lost): the map picture of one source around a layout, a picked photo cropped to the
picture, the world locator and the track's outline. A layer is kept only whole, when every tile came and they are
not all one picture. Every finished picture is kept in posters/ under a key of its route, its options and its
layers, at most 2 GB, the least recently used going first; a second season of a circuit draws from the kept layers
and fetches nothing. A picture whose map or photo did not arrive is served without it, kept nowhere, and sent with
five minutes' Cache-Control and no ETag.
Clients keep an address that carries the render version (?v=r3, as the Kometa file writes it) for good
(immutable); any other address a day, then ask again with its ETag and get a 304 while it is unchanged. Every
request the service makes carries the User-Agent f1-circuits/<version> (+<its public address>). OpenStreetMap tiles
are fetched only when a picture asks for them, at most two at once; Wikimedia Commons is asked one request at a time.
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, an unknown circuit or layout is named; a poster's satellite source,
credits and licence, its options, keys and cache headers, and the picture store's cap).
Acknowledgment
- Started from Tomislav Bacinger's f1-circuits, whose initial data source and altitudes (from Highs and lows - which F1 track has the most elevation changes?) are kept in the upstream files.
- Race schedules from Jolpica (CC BY-NC-SA 4.0); the posters' pictures from
Wikimedia Commons, USGS, PDOK (Beeldmateriaal Nederland), IGN, EOX (EOxCloudless) and OpenStreetMap, each under
its licence and with its credit:
/licencesand docs/posters.md.
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