#<Sentry::ErrorEvent:0x00007f4f7e14ff08>
by SHELDON PASCIAK
HTML
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Map with Markers</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Leaflet CSS -->
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-sA+e2j7M9Ue1f8DKyoFNDZmM5ShDd3tNAC39L2wQGMU="
crossorigin=""
/>
<style>
#map {
height: 100vh;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<!-- Leaflet JS -->
<script
src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-o3SfN2pGmH9l1zpCDcJ3C+1tYY5MJv6PVn+cf+3T5C8="
crossorigin=""
></script>
<script>
// Initialize map centered at some location
const map = L.map('map').setView([37.7749, -122.4194], 10); // San Francisco
// Add OpenStreetMap tiles
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
// Example data - an array of coordinates and labels
const markers = [
{ lat: 37.7749, lng: -122.4194, label: "San Francisco" },
{ lat: 37.8044, lng: -122.2711, label: "Oakland" },
{ lat: 37.6879, lng: -122.4702, label: "Daly City" },
{ lat: 37.8715, lng: -122.2730, label: "Berkeley" },
{ lat: 37.4419, lng: -122.1430, label: "Palo Alto" },
];
// Add each marker to the map
markers.forEach(({ lat, lng, label }) => {
L.marker([lat, lng]).addTo(map).bindPopup(label);
});
</script>
</body>
</html>