-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAPI_LeafLet_test.html
70 lines (60 loc) · 1.81 KB
/
API_LeafLet_test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Leaflet Map with Monumental Houses</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<style>
#map { height: 400px; }
.loading-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.loading-spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
border-left-color: #333;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="loading-overlay" id="loadingOverlay">
<div class="loading-spinner"></div>
</div>
<div id="map"></div>
<script>
var map = L.map('map').setView([51.9, 4.5], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// Fetch data from your API using fetch()
fetch('https://api.linkeddata.cultureelerfgoed.nl/queries/rce/Query-6-1-1-1-2-1/3/run?')
.then(response => response.json())
.then(data => {
data.forEach(function(house) {
var marker = L.marker([house.latitude, house.longitude]).addTo(map);
marker.bindPopup(house.name);
});
})
.catch(error => {
console.error('Error fetching data:', error);
});
</script>
</body>
</html>