|
const map = L.map('map').setView([20, 0], 2); |
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
|
attribution: '© OpenStreetMap contributors' |
|
}).addTo(map); |
|
|
|
|
|
const robotIcon = L.icon({ |
|
iconUrl: 'https://cdn.shopify.com/s/files/1/0767/2040/6877/files/LeRobot.png?v=1745423992', |
|
iconSize: [35, 35], |
|
iconAnchor: [20, 40], |
|
popupAnchor: [0, -35] |
|
}); |
|
|
|
fetch('data.json') |
|
.then(response => response.json()) |
|
.then(data => { |
|
data.forEach(entry => { |
|
const lat = parseFloat(entry.latitude || entry.Latitude); |
|
const lng = parseFloat(entry.longitude || entry.Longitude); |
|
const name = entry.name || entry.Name || 'Unknown'; |
|
const desc = entry.description || entry.Description || ''; |
|
|
|
if (!isNaN(lat) && !isNaN(lng)) { |
|
L.marker([lat, lng], { icon: robotIcon }) |
|
.addTo(map) |
|
.bindPopup(`<strong>${name}</strong><br>${desc}`); |
|
} |
|
}); |
|
}); |
|
|