Draw posters from kept layers of licensed sources, credited on every picture

Esri's, Bing's and Google's terms forbid keeping or serving pictures made from their maps, so the posters move to
sources whose licence allows a kept copy: a picked Wikimedia Commons photo, USGS, PDOK and IGN's frozen 2021-2023
mosaic by country, else EOxCloudless's newest mosaic, and OpenStreetMap for the maps and the locator. What needs
the network is a layer fetched once and kept whole in layers/; texts, colours, size and format are drawn on every
request, and finished pictures are kept in posters/ up to 2 GB. Every picture carries its sources' credit line,
X-Credits, X-License (which follows its sources) and a link to /licences. Options are checked into a named 422;
the Kometa file states Jolpica's licence and versions its addresses so clients keep them for good. A layout whose
trace is a point (Madring) is drawn at the circuit's location instead of failing.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
This commit is contained in:
2026-11-27 15:13:29 +01:00
parent 4f00403e13
commit db5c19f0d4
14 changed files with 1620 additions and 748 deletions
+17
View File
@@ -0,0 +1,17 @@
"""Who this service is to the outside: its version, its public address and the User-Agent it sends.
Standard library only: the Jolpica client, the poster sources and the API share it.
"""
import os
# The API's own version (cdn-api.py's FastAPI app says the same).
APP_VERSION = "1.0.0"
# The address this service is reached at, which the Kometa metadata links every poster to and every outgoing
# request names. The mesh writes it from the name the route is served under (F1_CIRCUITS_BASE_URL); the fallback
# is the address HAL served it at, so a deployment that sets nothing behaves as before.
PUBLIC_BASE_URL = os.environ.get("F1_CIRCUITS_BASE_URL", "https://f1-circuits.zurag.be").rstrip("/")
# Every outgoing request carries it (Jolpica, the map and photo sources): the app's name and its public address,
# never a person's address.
USER_AGENT = f"f1-circuits/{APP_VERSION} (+{PUBLIC_BASE_URL})"