I have successfully created my map, but I am facing an issue with getting markers or clusters to appear on it. Below is the JavaScript code I am using:
function initMap() {
var map = new google.maps.Map(document.getElementById("map"), {
zoom: 12,
center: { lat: 51.40219, lng: -0.16890 }
});
var labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
//Coordinates for the various Memorials and Cemeteries listed for the corresponding Hero that will be marked on the map.
// I used https://codepen.io/ahmadawais/pen/NQdWQx?editors=1010 to see how to do the below with the locations as this way it will show with the names of the memorials or cemeteries
var locations = [
['Private Richard Spearink - St Souplet British Cemetery', { lat: 50.05484, lng: 3.52440 }, 1],
['Private Frederick Spearink - Mitcham War Memorial', { lat: 51.40219, lng: -0.16890 }, 2],
['Private Frederick Spearink - Helles Memorial', { lat: 40.04597, lng: 26.17921}, 2]
];
var markers = locations.map(function(location, i) {
return new google.maps.Marker({
position: location,
label: labels[i % labels.length]
});
});
var markerCluster = new MarkerClusterer(map, markers, { imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m' });
Can someone please help me figure out what changes I need to make in order to fix this problem?