I have a map with custom markers taken from a MySQL database. With this code inserted inside the variable locations the coordinates directions of my table.
var locations = [
<?php
foreach ($rows as $row) {
?>
<?php if ($row['parametro'] != "5"): ?>
<?php echo "{lat: " . $row['lat'] . ", lng: " . $row['lng'] . "},"; ?>
<?php endif; ?>
<?php } ?>
]
It would stay this way
var locations = [
{lat: 51.958623, lng: -0.159154},
{lat: 51.958623, lng: -0.159154},
{lat: 51.958623, lng: -0.159154},
etc etc etc
]
And it works correctly, but I would like to know how to change the icons of brands like this, in custom icons
This is the complete code
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 8,
center: {lat: 41.6041581, lng: -3.980962}
});
var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
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'});
}