// Load the map from the Google Maps JS API function loadMap() { const map = new google.maps.Map(document.getElementById("map"), { center: {lat: 0, lng: 0}, // Center of the globe zoom: 2 }); const infoWindow = new google.maps.InfoWindow(); // create InfoWindow object to use later // Add custom markers from meteor data fetch("./js/Meteorite_Landings.json") .then((response) => response.json()) .then(data => { data.splice(0,500).forEach(location => { const marker = new google.maps.Marker({ position: { lat: location.reclat, lng: location.reclong}, map: map, title: location.name }); marker.addListener("click", () => { // Open and show the InfoWindow on click const content = `

${location.name}

Mass: ${location["mass (g)"]} g

Year: ${location.year}

Class: ${location.recclass}

Fall Status: ${location.fall}

Recorded Latitude: ${location.reclat}

Recorded Longitude: ${location.reclong}

`; // By doing this I have more control over what I put in the InfoWindow and how to style it infoWindow.setContent(content); infoWindow.open(map, marker); }); }); }) .catch(error => console.error(error)); };