Skip to content

Commit

Permalink
Update map.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit30swgoh authored Sep 25, 2024
1 parent a1a8786 commit ef29072
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions map.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
// map.js
// scripts/map.js

export function initMap() {
const mapElement = document.getElementById('map');

if (!mapElement) {
console.error('Map element with id "map" not found.');
return;
}

// Initialize the map centered at (0,0) with zoom level 2
const map = L.map('map').setView([0, 0], 2);

// Add OpenStreetMap tiles
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

// Add a marker for Huntsville, Texas
L.marker([29.7604, -95.3698]).addTo(map)
.bindPopup('Huntsville, Home to NASA\'s JWST operations')
.openPopup();
}
}

0 comments on commit ef29072

Please sign in to comment.