Files
courses/2026_Internship/maps/battery.html
T
2026-05-29 22:57:41 +02:00

55 lines
1.3 KiB
HTML
Executable File

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Battery Map</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<style>
html, body, #map {
margin: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script>
const germanyBounds = [
[47, 5],
[55, 16]
];
const map = L.map('map', {
zoomControl: false
});
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors'
}).addTo(map);
fetch('../data/speicher.geojson')
.then(res => res.json())
.then(data => {
L.geoJSON(data, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, {
radius: 1,
color: '#004682',
weight: 1,
opacity: 1,
fillOpacity: 1
});
}
}).addTo(map);
map.fitBounds(germanyBounds, { padding: [20, 20] });
})
.catch(err => console.error("Failed to load GeoJSON:", err));
</script>
</body>
</html>