-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
106 lines (95 loc) · 3.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html>
<head>
<title>Map Viewer</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""
/>
<script
src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""
></script>
<style>
body {
margin: 0;
}
.wrapper {
width: calc(100vw);
height: calc(100vh);
margin: 0 auto;
padding: 3rem;
box-sizing: border-box;
}
.map {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="map" id="mapid"></div>
</div>
<script>
var map = L.map("mapid").setView([54.2511, -4.4631], 6);
L.tileLayer(
"https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZ2hlbmRlcnNvbjUiLCJhIjoiY2xqNDc3b3hpMWw4YjNucDk0enJtZjlyciJ9.vy3y2eap6esYOMmsoQXTQw",
{
maxZoom: 18,
attribution:
'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: "mapbox/streets-v11",
tileSize: 512,
zoomOffset: -1,
}
).addTo(map);
(async () => {
const aacServicesResult = await fetch("/data/aac-services-geo.geojson");
const ecServicesResult = await fetch("/data/ec-services-geo.geojson");
const wcsServicesResult = await fetch("/data/wcs-services-geo.geojson");
const ccg21Result = await fetch(
"/archive/Clinical_Commissioning_Groups_(April_2021)_EN_BUC.json"
);
const scottishHealthBoardsResult = await fetch(
"/archive/health-boards-small.json"
);
const ICBsResult = await fetch("/archive/ICBs-2023.json");
const aac = await aacServicesResult.json();
const ec = await ecServicesResult.json();
const wcs = await wcsServicesResult.json();
const ccg21 = await ccg21Result.json();
const scottishHealthBoards = await scottishHealthBoardsResult.json();
const ICBs = await ICBsResult.json();
const onEachFeature =
(property = "serviceId") =>
(feature, layer) => {
layer.bindPopup(`<h1>${feature.properties[property]}</h1>`);
};
const layers = {
"AAC Services": L.geoJSON(aac, { onEachFeature: onEachFeature() }),
"EC Services": L.geoJSON(ec, { onEachFeature: onEachFeature() }),
"Wheelchair Services": L.geoJSON(wcs, {
onEachFeature: onEachFeature(),
}),
"CCG Codes 21": L.geoJSON(ccg21, {
onEachFeature: onEachFeature("CCG21CD"),
}),
"Scottish Health Boards": L.geoJSON(scottishHealthBoards, {
onEachFeature: onEachFeature("HBCode"),
}),
ICBs: L.geoJSON(ICBs, {
onEachFeature: onEachFeature("ICB23CD"),
}),
};
L.control.layers({}, layers, { collapsed: false }).addTo(map);
})();
</script>
</body>
</html>