41 lines
796 B
JavaScript
41 lines
796 B
JavaScript
function mp_init_map() {
|
|
|
|
/*
|
|
* following variable are created by mp_locations.php
|
|
* - let locations = [{lat:xxx, lng:xxx}, {}...]
|
|
* - let icon_url
|
|
* - let icon_size[x, y]
|
|
*/
|
|
|
|
let map = new google.maps.Map(
|
|
document.getElementById("ljdp_map"),
|
|
{
|
|
zoom: 5,
|
|
disableDefaultUI: true,
|
|
center: locations[0],
|
|
}
|
|
);
|
|
let marker, icon, label;
|
|
icon = {
|
|
url: icon_url,
|
|
scaledSize: new google.maps.Size(icon_size[0], icon_size[1]),
|
|
};
|
|
label = {
|
|
// text: String(count),
|
|
text: "hello",
|
|
color: icon_label_color,
|
|
fontSize: "12px",
|
|
};
|
|
let markers = [];
|
|
for (loc of locations) {
|
|
marker = new google.maps.Marker({
|
|
position: loc,
|
|
map: map,
|
|
icon: icon,
|
|
// label: label,
|
|
});
|
|
markers.push(marker);
|
|
};
|
|
new markerClusterer.MarkerClusterer({ map, markers });
|
|
}
|