added marker cluster

This commit is contained in:
lenovo
2022-11-01 09:16:09 +01:00
parent 7c6e480d1a
commit 57c7dac62a
6 changed files with 63 additions and 15 deletions

View File

@@ -2,8 +2,9 @@ function mp_init_map() {
/*
* following variable are created by mp_locations.php
* - let locations
* - let locations = [{lat:xxx, lng:xxx}, {}...]
* - let icon_url
* - let icon_size[x, y]
*/
let map = new google.maps.Map(
@@ -14,16 +15,26 @@ function mp_init_map() {
center: locations[0],
}
);
let marker, icon;
let marker, icon, label;
icon = {
url: icon_url,
scaledSize: new google.maps.Size(35, 50)
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 });
}