SPB Git

spb/ora-ka Public

Ora-Ka — cinq agrégateurs Ka, une barre de recherche hybride (exact + sémantique)

Python 80% TypeScript 12.9% CSS 6.8%
14.4 KB · 236 lines typescript
Raw Blame History
1// -----------------------------------------------------------------------------2// Immo-Ka — Agrégateur de propriétés à vendre (province de Québec)3// Auteur : Simon-Pierre Boucher — contact@spboucher.ai4// map/immokaStyle.ts : style cartographique « Groupe Ka », écrit FROM SCRATCH5//   sur le schéma OpenMapTiles (tuiles vectorielles libres OpenFreeMap).6//   Direction « éditoriale contrastée » : crème chaud, eau bleue franche,7//   forêts vertes, autoroutes rouges (la marque), primaires jaune Michelin,8//   relief au zoom province — une carte de magazine, pas un fond gris.9// -----------------------------------------------------------------------------10import type { StyleSpecification } from "maplibre-gl";1112// ---- palette éditoriale -----------------------------------------------------13const PAPER = "#f6efe6";        // crème chaud14const WATER = "#a6c7dd";        // eau bleue franche15const WATER_DEEP = "#97bcd6";   // océan / grands plans d'eau16const GRASS = "#dce8c6";        // prés / cultures17const WOOD = "#c4dcae";         // forêts — vert affirmé18const PARK = "#cbe3b3";         // parcs19const RESID = "#efe2d2";        // trame urbaine sable20const INDUS = "#e9e0e2";        // industriel mauve-gris21const SAND = "#f3e8c9";22const BUILD = "#e2cdbd";        // bâtiments terracotta pâle23const BUILD_LINE = "#d2b7a4";24const MOTOR = "#e0584c";        // autoroutes — ROUGE Immo-Ka25const MOTOR_CASE = "#ad342d";26const PRIM = "#f6d17c";         // primaires — jaune éditorial27const PRIM_CASE = "#cfa14a";28const ROAD = "#ffffff";29const ROAD_CASE = "#cfbcab";30const MINOR_CASE = "#dccbba";31const RAIL = "#a29191";32const BOUND = "#a77f8b";33const INK = "#2a2024";          // étiquettes principales34const INK_SOFT = "#6d5d60";35const WATER_INK = "#3f6f92";36const GREEN_INK = "#5c7a45";3738const style: StyleSpecification = {39  version: 8,40  name: "Immo-Ka · Groupe Ka (éditorial)",41  glyphs: "https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",42  sources: {43    omt: { type: "vector", url: "https://tiles.openfreemap.org/planet" },44    relief: {45      type: "raster", maxzoom: 6, tileSize: 256,46      tiles: ["https://tiles.openfreemap.org/natural_earth/ne2sr/{z}/{x}/{y}.png"],47    },48  },49  layers: [50    { id: "bg", type: "background", paint: { "background-color": PAPER } },5152    // relief léger au zoom province — donne du corps à la vue d'ensemble53    { id: "relief", type: "raster", source: "relief", maxzoom: 7,54      paint: { "raster-opacity": ["interpolate", ["linear"], ["zoom"], 0, 0.55, 5, 0.45, 6.5, 0] } },5556    // --- occupation du sol -------------------------------------------------57    { id: "landcover-grass", type: "fill", source: "omt", "source-layer": "landcover",58      filter: ["in", ["get", "class"], ["literal", ["grass", "farmland"]]],59      paint: { "fill-color": GRASS, "fill-opacity": 0.85 } },60    { id: "landcover-wetland", type: "fill", source: "omt", "source-layer": "landcover",61      filter: ["==", ["get", "class"], "wetland"],62      paint: { "fill-color": "#cfe0cf", "fill-opacity": 0.7 } },63    { id: "landcover-wood", type: "fill", source: "omt", "source-layer": "landcover",64      filter: ["==", ["get", "class"], "wood"],65      paint: { "fill-color": WOOD,66               "fill-opacity": ["interpolate", ["linear"], ["zoom"], 5, 0.7, 11, 0.9] } },67    { id: "landcover-sand", type: "fill", source: "omt", "source-layer": "landcover",68      filter: ["==", ["get", "class"], "sand"], paint: { "fill-color": SAND } },69    { id: "landcover-ice", type: "fill", source: "omt", "source-layer": "landcover",70      filter: ["==", ["get", "class"], "ice"], paint: { "fill-color": "#eef4f6" } },71    { id: "landuse-residential", type: "fill", source: "omt", "source-layer": "landuse",72      filter: ["in", ["get", "class"], ["literal", ["residential", "suburb", "neighbourhood"]]],73      paint: { "fill-color": RESID,74               "fill-opacity": ["interpolate", ["linear"], ["zoom"], 8, 0.5, 12, 0.9] } },75    { id: "landuse-indus", type: "fill", source: "omt", "source-layer": "landuse",76      filter: ["in", ["get", "class"], ["literal", ["industrial", "commercial", "quarry", "railway"]]],77      paint: { "fill-color": INDUS, "fill-opacity": 0.7 } },78    { id: "landuse-green", type: "fill", source: "omt", "source-layer": "landuse",79      filter: ["in", ["get", "class"], ["literal", ["cemetery", "stadium", "pitch", "playground"]]],80      paint: { "fill-color": PARK, "fill-opacity": 0.6 } },81    { id: "park", type: "fill", source: "omt", "source-layer": "park",82      paint: { "fill-color": PARK, "fill-opacity": 0.75 } },8384    // --- eau ---------------------------------------------------------------85    { id: "waterway", type: "line", source: "omt", "source-layer": "waterway",86      paint: { "line-color": WATER,87               "line-width": ["interpolate", ["exponential", 1.4], ["zoom"], 8, 0.8, 14, 3, 18, 8] } },88    { id: "water", type: "fill", source: "omt", "source-layer": "water",89      paint: { "fill-color": ["case", ["==", ["get", "class"], "ocean"], WATER_DEEP, WATER] } },9091    // --- aéroports ----------------------------------------------------------92    { id: "aeroway", type: "line", source: "omt", "source-layer": "aeroway",93      minzoom: 11, filter: ["in", ["get", "class"], ["literal", ["runway", "taxiway"]]],94      paint: { "line-color": "#e6d9d2",95               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 11, 1, 16, 26] } },9697    // --- tunnels --------------------------------------------------------------98    { id: "tunnel", type: "line", source: "omt", "source-layer": "transportation",99      filter: ["==", ["get", "brunnel"], "tunnel"],100      paint: { "line-color": ROAD_CASE, "line-dasharray": [2, 2],101               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 8, 0.8, 14, 3.5, 18, 12] } },102103    // --- voirie : liserés (du bas vers le haut de la hiérarchie) ---------------104    { id: "road-minor-case", type: "line", source: "omt", "source-layer": "transportation",105      minzoom: 11,106      filter: ["all", ["!=", ["get", "brunnel"], "tunnel"],107               ["in", ["get", "class"], ["literal", ["minor", "service", "track"]]]],108      layout: { "line-cap": "round", "line-join": "round" },109      paint: { "line-color": MINOR_CASE,110               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 11, 1.2, 15, 5, 18, 16] } },111    { id: "road-mid-case", type: "line", source: "omt", "source-layer": "transportation",112      minzoom: 9,113      filter: ["all", ["!=", ["get", "brunnel"], "tunnel"],114               ["in", ["get", "class"], ["literal", ["secondary", "tertiary"]]]],115      layout: { "line-cap": "round", "line-join": "round" },116      paint: { "line-color": ROAD_CASE,117               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 9, 2, 14, 7, 18, 22] } },118    { id: "road-prim-case", type: "line", source: "omt", "source-layer": "transportation",119      minzoom: 7,120      filter: ["all", ["!=", ["get", "brunnel"], "tunnel"],121               ["in", ["get", "class"], ["literal", ["primary", "trunk"]]]],122      layout: { "line-cap": "round", "line-join": "round" },123      paint: { "line-color": PRIM_CASE,124               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 7, 1.8, 14, 8, 18, 26] } },125    { id: "motorway-case", type: "line", source: "omt", "source-layer": "transportation",126      minzoom: 5, filter: ["==", ["get", "class"], "motorway"],127      layout: { "line-cap": "round", "line-join": "round" },128      paint: { "line-color": MOTOR_CASE,129               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 5, 1.4, 14, 9, 18, 28] } },130131    // --- voirie : remplissages ---------------------------------------------------132    { id: "road-path", type: "line", source: "omt", "source-layer": "transportation",133      minzoom: 14, filter: ["==", ["get", "class"], "path"],134      paint: { "line-color": "#b8a394", "line-dasharray": [2.5, 2],135               "line-width": ["interpolate", ["linear"], ["zoom"], 14, 0.8, 18, 2.5] } },136    { id: "road-minor", type: "line", source: "omt", "source-layer": "transportation",137      minzoom: 11,138      filter: ["all", ["!=", ["get", "brunnel"], "tunnel"],139               ["in", ["get", "class"], ["literal", ["minor", "service", "track"]]]],140      layout: { "line-cap": "round", "line-join": "round" },141      paint: { "line-color": ROAD,142               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 11, 0.7, 15, 3.8, 18, 13] } },143    { id: "road-mid", type: "line", source: "omt", "source-layer": "transportation",144      minzoom: 9,145      filter: ["all", ["!=", ["get", "brunnel"], "tunnel"],146               ["in", ["get", "class"], ["literal", ["secondary", "tertiary"]]]],147      layout: { "line-cap": "round", "line-join": "round" },148      paint: { "line-color": ROAD,149               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 9, 1.3, 14, 5.5, 18, 18] } },150    { id: "road-prim", type: "line", source: "omt", "source-layer": "transportation",151      minzoom: 7,152      filter: ["all", ["!=", ["get", "brunnel"], "tunnel"],153               ["in", ["get", "class"], ["literal", ["primary", "trunk"]]]],154      layout: { "line-cap": "round", "line-join": "round" },155      paint: { "line-color": PRIM,156               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 7, 1.1, 14, 6.5, 18, 22] } },157    { id: "motorway", type: "line", source: "omt", "source-layer": "transportation",158      minzoom: 5, filter: ["==", ["get", "class"], "motorway"],159      layout: { "line-cap": "round", "line-join": "round" },160      paint: { "line-color": MOTOR,161               "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 5, 0.9, 14, 7, 18, 24] } },162    { id: "rail", type: "line", source: "omt", "source-layer": "transportation",163      minzoom: 10, filter: ["==", ["get", "class"], "rail"],164      paint: { "line-color": RAIL, "line-dasharray": [3, 3],165               "line-width": ["interpolate", ["linear"], ["zoom"], 10, 0.7, 16, 2.2] } },166167    // --- ponts (léger liseré pour lecture) -----------------------------------------168    { id: "bridge-case", type: "line", source: "omt", "source-layer": "transportation",169      minzoom: 12, filter: ["==", ["get", "brunnel"], "bridge"],170      paint: { "line-color": "#b7a08e", "line-gap-width":171               ["interpolate", ["exponential", 1.5], ["zoom"], 12, 3, 18, 20], "line-width": 1.2 } },172173    // --- bâtiments -------------------------------------------------------------------174    { id: "building", type: "fill", source: "omt", "source-layer": "building",175      minzoom: 13,176      paint: { "fill-color": BUILD, "fill-outline-color": BUILD_LINE,177               "fill-opacity": ["interpolate", ["linear"], ["zoom"], 13, 0.55, 16, 0.95] } },178179    // --- frontières -----------------------------------------------------------------180    { id: "boundary-prov", type: "line", source: "omt", "source-layer": "boundary",181      filter: ["all", ["==", ["get", "admin_level"], 4], ["!=", ["get", "maritime"], 1]],182      paint: { "line-color": BOUND, "line-dasharray": [4, 3],183               "line-width": ["interpolate", ["linear"], ["zoom"], 4, 0.8, 10, 1.6] } },184    { id: "boundary-country", type: "line", source: "omt", "source-layer": "boundary",185      filter: ["all", ["==", ["get", "admin_level"], 2], ["!=", ["get", "maritime"], 1]],186      paint: { "line-color": BOUND,187               "line-width": ["interpolate", ["linear"], ["zoom"], 3, 1.2, 10, 2.6] } },188189    // --- étiquettes --------------------------------------------------------------------190    { id: "park-label", type: "symbol", source: "omt", "source-layer": "park",191      minzoom: 11, filter: ["==", ["geometry-type"], "Point"],192      layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]],193                "text-font": ["Noto Sans Italic"], "text-size": 11.5 },194      paint: { "text-color": GREEN_INK, "text-halo-color": PAPER, "text-halo-width": 1.4 } },195    { id: "water-label", type: "symbol", source: "omt", "source-layer": "water_name",196      layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]],197                "text-font": ["Noto Sans Italic"],198                "text-size": ["interpolate", ["linear"], ["zoom"], 6, 11, 12, 14] },199      paint: { "text-color": WATER_INK, "text-halo-color": "rgba(246,239,230,0.75)",200               "text-halo-width": 1.2 } },201    { id: "road-label", type: "symbol", source: "omt", "source-layer": "transportation_name",202      minzoom: 12.5,203      layout: { "symbol-placement": "line",204                "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]],205                "text-font": ["Noto Sans Regular"], "text-size": 11.5 },206      paint: { "text-color": INK_SOFT, "text-halo-color": PAPER, "text-halo-width": 1.6 } },207    { id: "place-village", type: "symbol", source: "omt", "source-layer": "place",208      minzoom: 9,209      filter: ["in", ["get", "class"], ["literal", ["village", "suburb", "neighbourhood", "hamlet"]]],210      layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]],211                "text-font": ["Noto Sans Regular"],212                "text-size": ["interpolate", ["linear"], ["zoom"], 9, 11, 14, 13.5] },213      paint: { "text-color": INK_SOFT, "text-halo-color": PAPER, "text-halo-width": 1.7 } },214    { id: "place-town", type: "symbol", source: "omt", "source-layer": "place",215      filter: ["==", ["get", "class"], "town"],216      layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]],217                "text-font": ["Noto Sans Bold"],218                "text-size": ["interpolate", ["linear"], ["zoom"], 6, 12, 12, 16] },219      paint: { "text-color": INK, "text-halo-color": PAPER, "text-halo-width": 1.8 } },220    { id: "place-city", type: "symbol", source: "omt", "source-layer": "place",221      filter: ["==", ["get", "class"], "city"],222      layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]],223                "text-font": ["Noto Sans Bold"],224                "text-size": ["interpolate", ["linear"], ["zoom"], 4, 13, 10, 19] },225      paint: { "text-color": INK, "text-halo-color": PAPER, "text-halo-width": 2 } },226    { id: "place-state", type: "symbol", source: "omt", "source-layer": "place",227      maxzoom: 7, filter: ["==", ["get", "class"], "state"],228      layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]],229                "text-font": ["Noto Sans Regular"], "text-size": 11.5,230                "text-transform": "uppercase", "text-letter-spacing": 0.18 },231      paint: { "text-color": BOUND, "text-halo-color": PAPER, "text-halo-width": 1.5 } },232  ],233};234235export default style;236