KSvend Claude Happy commited on
Commit
cc94dbe
Β·
1 Parent(s): 7773924

refactor: rename MAP_STYLE to POSITRON_STYLE and add SATELLITE_STYLE constant

Browse files

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

Files changed (1) hide show
  1. frontend/js/map.js +26 -3
frontend/js/map.js CHANGED
@@ -3,7 +3,30 @@
3
  * Manages the AOI definition map (Define Area page) and the results map.
4
  */
5
 
6
- const MAP_STYLE = 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  /* ── AOI Map ─────────────────────────────────────────────── */
9
 
@@ -21,7 +44,7 @@ export function initAoiMap(containerId, onAoiChange) {
21
 
22
  _aoiMap = new maplibregl.Map({
23
  container: containerId,
24
- style: MAP_STYLE,
25
  center: [37.0, 3.0], // East Africa default
26
  zoom: 4,
27
  });
@@ -147,7 +170,7 @@ let _resultsMap = null;
147
  export function initResultsMap(containerId, bbox) {
148
  _resultsMap = new maplibregl.Map({
149
  container: containerId,
150
- style: MAP_STYLE,
151
  bounds: [[bbox[0], bbox[1]], [bbox[2], bbox[3]]],
152
  fitBoundsOptions: { padding: 60 },
153
  });
 
3
  * Manages the AOI definition map (Define Area page) and the results map.
4
  */
5
 
6
+ const POSITRON_STYLE = 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json';
7
+
8
+ const SATELLITE_STYLE = {
9
+ version: 8,
10
+ sources: {
11
+ 'esri-satellite': {
12
+ type: 'raster',
13
+ tiles: [
14
+ 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
15
+ ],
16
+ tileSize: 256,
17
+ attribution: '&copy; Esri',
18
+ },
19
+ },
20
+ layers: [
21
+ {
22
+ id: 'esri-satellite-layer',
23
+ type: 'raster',
24
+ source: 'esri-satellite',
25
+ minzoom: 0,
26
+ maxzoom: 19,
27
+ },
28
+ ],
29
+ };
30
 
31
  /* ── AOI Map ─────────────────────────────────────────────── */
32
 
 
44
 
45
  _aoiMap = new maplibregl.Map({
46
  container: containerId,
47
+ style: POSITRON_STYLE,
48
  center: [37.0, 3.0], // East Africa default
49
  zoom: 4,
50
  });
 
170
  export function initResultsMap(containerId, bbox) {
171
  _resultsMap = new maplibregl.Map({
172
  container: containerId,
173
+ style: POSITRON_STYLE,
174
  bounds: [[bbox[0], bbox[1]], [bbox[2], bbox[3]]],
175
  fitBoundsOptions: { padding: 60 },
176
  });