-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.js
24 lines (22 loc) · 871 Bytes
/
map.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var map = L.map('map').setView([44, -85.2], 7);
L.tileLayer('https://tile.thunderforest.com/atlas/{z}/{x}/{y}.png?apikey=99446c586a174ce29291d944db9e2088', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
document.addEventListener('DOMContentLoaded', function() {
fetch('Info.json')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
data.teams.forEach((element) => {
marker = L.marker(element.location).addTo(map).bindPopup(String(element.number));
});
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
});