|
1 |
+// ----------------------------------------------------------------------------- |
|
2 |
+// Immo-Ka — Agrégateur de propriétés à vendre (province de Québec) |
|
3 |
+// Auteur : Simon-Pierre Boucher — contact@spboucher.ai |
|
4 |
+// map/immokaStyle.ts : style cartographique « Groupe Ka », écrit FROM SCRATCH |
|
5 |
+// sur le schéma OpenMapTiles (tuiles vectorielles libres OpenFreeMap). |
|
6 |
+// Palette maison : papier chaud, eau froide en contraste, routes crème, |
|
7 |
+// autoroutes blush, étiquettes encre chocolat — la carte EST la marque. |
|
8 |
+// ----------------------------------------------------------------------------- |
|
9 |
+import type { StyleSpecification } from "maplibre-gl"; |
|
10 |
+ |
|
11 |
+// Palette (alignée sur styles.css) |
|
12 |
+const PAPER = "#f7f1ef"; // fond — papier chaud |
|
13 |
+const WATER = "#cfdde4"; // eau — gris-bleu froid (contraste voulu) |
|
14 |
+const GREEN_1 = "#e7ece0"; // couvert végétal léger |
|
15 |
+const GREEN_2 = "#dde5d4"; // bois / forêt |
|
16 |
+const PARK = "#dfe9d8"; // parcs |
|
17 |
+const RESID = "#f2e9e6"; // trame résidentielle (à peine plus foncée) |
|
18 |
+const BUILD = "#e9dcd8"; // bâtiments |
|
19 |
+const ROAD = "#ffffff"; // voirie — crème/blanc |
|
20 |
+const ROAD_CASE = "#e3d4d1"; // liseré de voirie |
|
21 |
+const MOTOR = "#f3cfd0"; // autoroutes — blush (clin d'œil rouge Immo-Ka) |
|
22 |
+const MOTOR_CASE = "#dfb0b3"; |
|
23 |
+const RAIL = "#d8c9c8"; |
|
24 |
+const BOUND = "#c49399"; // frontières — vieux rose |
|
25 |
+const INK = "#3f3033"; // étiquettes — encre chocolat |
|
26 |
+const INK_SOFT = "#7a6a6d"; |
|
27 |
+const WATER_INK = "#5e7b8a"; |
|
28 |
+ |
|
29 |
+const style: StyleSpecification = { |
|
30 |
+ version: 8, |
|
31 |
+ name: "Immo-Ka · Groupe Ka", |
|
32 |
+ glyphs: "https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf", |
|
33 |
+ sources: { |
|
34 |
+ omt: { type: "vector", url: "https://tiles.openfreemap.org/planet" }, |
|
35 |
+ }, |
|
36 |
+ layers: [ |
|
37 |
+ { id: "bg", type: "background", paint: { "background-color": PAPER } }, |
|
38 |
+ |
|
39 |
+ // --- occupation du sol ------------------------------------------------- |
|
40 |
+ { id: "landcover-grass", type: "fill", source: "omt", "source-layer": "landcover", |
|
41 |
+ filter: ["in", ["get", "class"], ["literal", ["grass", "farmland", "wetland"]]], |
|
42 |
+ paint: { "fill-color": GREEN_1, "fill-opacity": 0.7 } }, |
|
43 |
+ { id: "landcover-wood", type: "fill", source: "omt", "source-layer": "landcover", |
|
44 |
+ filter: ["==", ["get", "class"], "wood"], |
|
45 |
+ paint: { "fill-color": GREEN_2, "fill-opacity": ["interpolate", ["linear"], ["zoom"], 6, 0.5, 12, 0.8] } }, |
|
46 |
+ { id: "landcover-ice", type: "fill", source: "omt", "source-layer": "landcover", |
|
47 |
+ filter: ["==", ["get", "class"], "ice"], paint: { "fill-color": "#f2f4f5" } }, |
|
48 |
+ { id: "landuse-residential", type: "fill", source: "omt", "source-layer": "landuse", |
|
49 |
+ filter: ["in", ["get", "class"], ["literal", ["residential", "suburb", "neighbourhood"]]], |
|
50 |
+ paint: { "fill-color": RESID, "fill-opacity": ["interpolate", ["linear"], ["zoom"], 8, 0.35, 12, 0.75] } }, |
|
51 |
+ { id: "park", type: "fill", source: "omt", "source-layer": "park", |
|
52 |
+ paint: { "fill-color": PARK, "fill-opacity": 0.85 } }, |
|
53 |
+ |
|
54 |
+ // --- eau --------------------------------------------------------------- |
|
55 |
+ { id: "waterway", type: "line", source: "omt", "source-layer": "waterway", |
|
56 |
+ paint: { "line-color": WATER, |
|
57 |
+ "line-width": ["interpolate", ["exponential", 1.4], ["zoom"], 8, 0.6, 14, 2.5, 18, 6] } }, |
|
58 |
+ { id: "water", type: "fill", source: "omt", "source-layer": "water", |
|
59 |
+ paint: { "fill-color": WATER } }, |
|
60 |
+ |
|
61 |
+ // --- aéroports ---------------------------------------------------------- |
|
62 |
+ { id: "aeroway", type: "line", source: "omt", "source-layer": "aeroway", |
|
63 |
+ minzoom: 11, filter: ["in", ["get", "class"], ["literal", ["runway", "taxiway"]]], |
|
64 |
+ paint: { "line-color": "#eee3e0", |
|
65 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 11, 1, 16, 24] } }, |
|
66 |
+ |
|
67 |
+ // --- tunnels (discrets, pointillés) -------------------------------------- |
|
68 |
+ { id: "tunnel", type: "line", source: "omt", "source-layer": "transportation", |
|
69 |
+ filter: ["==", ["get", "brunnel"], "tunnel"], |
|
70 |
+ paint: { "line-color": ROAD_CASE, "line-dasharray": [2, 2], |
|
71 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 8, 0.8, 14, 3, 18, 10] } }, |
|
72 |
+ |
|
73 |
+ // --- voirie (liseré puis remplissage) ------------------------------------ |
|
74 |
+ { id: "road-minor-case", type: "line", source: "omt", "source-layer": "transportation", |
|
75 |
+ minzoom: 12, |
|
76 |
+ filter: ["all", ["!=", ["get", "brunnel"], "tunnel"], |
|
77 |
+ ["in", ["get", "class"], ["literal", ["minor", "service", "track", "path"]]]], |
|
78 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
79 |
+ paint: { "line-color": ROAD_CASE, |
|
80 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 12, 1.4, 15, 4, 18, 14] } }, |
|
81 |
+ { id: "road-minor", type: "line", source: "omt", "source-layer": "transportation", |
|
82 |
+ minzoom: 12, |
|
83 |
+ filter: ["all", ["!=", ["get", "brunnel"], "tunnel"], |
|
84 |
+ ["in", ["get", "class"], ["literal", ["minor", "service", "track", "path"]]]], |
|
85 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
86 |
+ paint: { "line-color": ROAD, |
|
87 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 12, 0.8, 15, 3, 18, 12] } }, |
|
88 |
+ { id: "road-mid-case", type: "line", source: "omt", "source-layer": "transportation", |
|
89 |
+ minzoom: 9, |
|
90 |
+ filter: ["all", ["!=", ["get", "brunnel"], "tunnel"], |
|
91 |
+ ["in", ["get", "class"], ["literal", ["secondary", "tertiary"]]]], |
|
92 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
93 |
+ paint: { "line-color": ROAD_CASE, |
|
94 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 9, 1.6, 14, 6, 18, 20] } }, |
|
95 |
+ { id: "road-mid", type: "line", source: "omt", "source-layer": "transportation", |
|
96 |
+ minzoom: 9, |
|
97 |
+ filter: ["all", ["!=", ["get", "brunnel"], "tunnel"], |
|
98 |
+ ["in", ["get", "class"], ["literal", ["secondary", "tertiary"]]]], |
|
99 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
100 |
+ paint: { "line-color": ROAD, |
|
101 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 9, 1, 14, 4.5, 18, 17] } }, |
|
102 |
+ { id: "road-major-case", type: "line", source: "omt", "source-layer": "transportation", |
|
103 |
+ minzoom: 7, |
|
104 |
+ filter: ["all", ["!=", ["get", "brunnel"], "tunnel"], |
|
105 |
+ ["in", ["get", "class"], ["literal", ["primary", "trunk"]]]], |
|
106 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
107 |
+ paint: { "line-color": ROAD_CASE, |
|
108 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 7, 1.2, 14, 7, 18, 24] } }, |
|
109 |
+ { id: "road-major", type: "line", source: "omt", "source-layer": "transportation", |
|
110 |
+ minzoom: 7, |
|
111 |
+ filter: ["all", ["!=", ["get", "brunnel"], "tunnel"], |
|
112 |
+ ["in", ["get", "class"], ["literal", ["primary", "trunk"]]]], |
|
113 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
114 |
+ paint: { "line-color": ROAD, |
|
115 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 7, 0.75, 14, 5, 18, 20] } }, |
|
116 |
+ { id: "motorway-case", type: "line", source: "omt", "source-layer": "transportation", |
|
117 |
+ minzoom: 5, filter: ["==", ["get", "class"], "motorway"], |
|
118 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
119 |
+ paint: { "line-color": MOTOR_CASE, |
|
120 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 5, 0.9, 14, 8, 18, 26] } }, |
|
121 |
+ { id: "motorway", type: "line", source: "omt", "source-layer": "transportation", |
|
122 |
+ minzoom: 5, filter: ["==", ["get", "class"], "motorway"], |
|
123 |
+ layout: { "line-cap": "round", "line-join": "round" }, |
|
124 |
+ paint: { "line-color": MOTOR, |
|
125 |
+ "line-width": ["interpolate", ["exponential", 1.5], ["zoom"], 5, 0.6, 14, 6, 18, 22] } }, |
|
126 |
+ { id: "rail", type: "line", source: "omt", "source-layer": "transportation", |
|
127 |
+ minzoom: 10, filter: ["==", ["get", "class"], "rail"], |
|
128 |
+ paint: { "line-color": RAIL, "line-dasharray": [3, 3], |
|
129 |
+ "line-width": ["interpolate", ["linear"], ["zoom"], 10, 0.6, 16, 2] } }, |
|
130 |
+ |
|
131 |
+ // --- bâtiments ------------------------------------------------------------ |
|
132 |
+ { id: "building", type: "fill", source: "omt", "source-layer": "building", |
|
133 |
+ minzoom: 13, |
|
134 |
+ paint: { "fill-color": BUILD, "fill-outline-color": "#ddc9c4", |
|
135 |
+ "fill-opacity": ["interpolate", ["linear"], ["zoom"], 13, 0.45, 16, 0.9] } }, |
|
136 |
+ |
|
137 |
+ // --- frontières ------------------------------------------------------------- |
|
138 |
+ { id: "boundary-prov", type: "line", source: "omt", "source-layer": "boundary", |
|
139 |
+ filter: ["all", ["==", ["get", "admin_level"], 4], ["!=", ["get", "maritime"], 1]], |
|
140 |
+ paint: { "line-color": BOUND, "line-dasharray": [4, 3], "line-width": 1 } }, |
|
141 |
+ { id: "boundary-country", type: "line", source: "omt", "source-layer": "boundary", |
|
142 |
+ filter: ["all", ["==", ["get", "admin_level"], 2], ["!=", ["get", "maritime"], 1]], |
|
143 |
+ paint: { "line-color": BOUND, |
|
144 |
+ "line-width": ["interpolate", ["linear"], ["zoom"], 3, 0.8, 10, 2] } }, |
|
145 |
+ |
|
146 |
+ // --- étiquettes --------------------------------------------------------------- |
|
147 |
+ { id: "water-label", type: "symbol", source: "omt", "source-layer": "water_name", |
|
148 |
+ layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]], |
|
149 |
+ "text-font": ["Noto Sans Italic"], "text-size": 12 }, |
|
150 |
+ paint: { "text-color": WATER_INK, "text-halo-color": PAPER, "text-halo-width": 1 } }, |
|
151 |
+ { id: "road-label", type: "symbol", source: "omt", "source-layer": "transportation_name", |
|
152 |
+ minzoom: 13, |
|
153 |
+ layout: { "symbol-placement": "line", |
|
154 |
+ "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]], |
|
155 |
+ "text-font": ["Noto Sans Regular"], "text-size": 11 }, |
|
156 |
+ paint: { "text-color": INK_SOFT, "text-halo-color": PAPER, "text-halo-width": 1.5 } }, |
|
157 |
+ { id: "place-village", type: "symbol", source: "omt", "source-layer": "place", |
|
158 |
+ minzoom: 9, |
|
159 |
+ filter: ["in", ["get", "class"], ["literal", ["village", "suburb", "neighbourhood", "hamlet"]]], |
|
160 |
+ layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]], |
|
161 |
+ "text-font": ["Noto Sans Regular"], |
|
162 |
+ "text-size": ["interpolate", ["linear"], ["zoom"], 9, 10.5, 14, 13] }, |
|
163 |
+ paint: { "text-color": INK_SOFT, "text-halo-color": PAPER, "text-halo-width": 1.6 } }, |
|
164 |
+ { id: "place-town", type: "symbol", source: "omt", "source-layer": "place", |
|
165 |
+ filter: ["==", ["get", "class"], "town"], |
|
166 |
+ layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]], |
|
167 |
+ "text-font": ["Noto Sans Regular"], |
|
168 |
+ "text-size": ["interpolate", ["linear"], ["zoom"], 6, 11, 12, 15] }, |
|
169 |
+ paint: { "text-color": INK, "text-halo-color": PAPER, "text-halo-width": 1.6 } }, |
|
170 |
+ { id: "place-city", type: "symbol", source: "omt", "source-layer": "place", |
|
171 |
+ filter: ["==", ["get", "class"], "city"], |
|
172 |
+ layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]], |
|
173 |
+ "text-font": ["Noto Sans Bold"], |
|
174 |
+ "text-size": ["interpolate", ["linear"], ["zoom"], 4, 12, 10, 17], |
|
175 |
+ "text-transform": "none" }, |
|
176 |
+ paint: { "text-color": INK, "text-halo-color": PAPER, "text-halo-width": 1.8 } }, |
|
177 |
+ { id: "place-state", type: "symbol", source: "omt", "source-layer": "place", |
|
178 |
+ maxzoom: 7, filter: ["==", ["get", "class"], "state"], |
|
179 |
+ layout: { "text-field": ["coalesce", ["get", "name:fr"], ["get", "name"]], |
|
180 |
+ "text-font": ["Noto Sans Regular"], "text-size": 11, |
|
181 |
+ "text-transform": "uppercase", "text-letter-spacing": 0.15 }, |
|
182 |
+ paint: { "text-color": BOUND, "text-halo-color": PAPER, "text-halo-width": 1.5 } }, |
|
183 |
+ ], |
|
184 |
+}; |
|
185 |
+ |
|
186 |
+export default style; |