-
Notifications
You must be signed in to change notification settings - Fork 1
/
maptest.html
42 lines (39 loc) · 1.17 KB
/
maptest.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wikidata Query Results Map</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<style>
#map {
height: 400px;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script>
var map = L.map('map').setView([0, 0], 2); // Set initial map view
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// Replace this with your query results
var queryResults = [
{
label: 'Location 1',
coordinates: [51.505, -0.09] // Example coordinates
},
{
label: 'Location 2',
coordinates: [40.7128, -74.0060] // Example coordinates
}
];
// Add markers for each query result
queryResults.forEach(function(result) {
L.marker(result.coordinates).addTo(map).bindPopup(result.label);
});
</script>
</body>
</html>