// Fond de carte commun aux cartes Leaflet. // CARTO exige une clé depuis le 23/09/2026 (sans clé : filigrane « API KEY REQUIRED »). // Clé fournie au runtime par NUXT_PUBLIC_CARTO_KEY ; sans clé, repli sur le Plan IGN (Géoplateforme, sans clé). const IGN_URL = 'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0' + '&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&TILEMATRIXSET=PM_0_19&FORMAT=image/png' + '&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}' export function useBaseTiles() { const key = useRuntimeConfig().public.cartoKey as string function url(dark: boolean) { if (!key) return IGN_URL const style = dark ? 'dark_all' : 'light_all' return `https://{s}.basemaps.cartocdn.com/${style}/{z}/{x}/{y}{r}.png?key=${encodeURIComponent(key)}` } const attribution = key ? '© OpenStreetMap contributors © CARTO' : '© IGN – Géoplateforme' return { url, attribution } }